Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: $SYBASE not recognized
Date: Jul 23 2002 3:07PM

On Tue, 2002-07-23 at 07:52, wrote:
> I'm not sure if this is better suited for the perl mailing list or the
> Sybperl mailing list, but here goes:

This is the appropriate place.

> #!/usr/bin/perl
> $ENV{"SYBASE"}="/opt/sybase";


> use Sybase::CTlib;

A couple of issues here.

First - a perl "use" command is run *before* the rest of the script - so
although you are setting $ENV{SYBASE} to something before the "use"
command in your script the assignment is only executed *after* the "use"
commands have been executed.

To have the %ENV value set before the "use" statement executes you have
to use a BEGIN block:

   $ENV{SYBASE} = "/opt/sybase-12.5";

use Sybase::CTlib;

Next - you can't set LD_LIBRARY_PATH for the running process. It just
won't take, no matter how hard you try.... You can only set this env.
variable for children of the current process.

On linux LD_LIBRARY_PATH should not be needed - you should have an entry
on /etc/ that points to /opt/sybase-12.5/OCS/lib, and the
dynamic loaded ( should use that value when looking for shared

Now as an aside - you are saying that this is for CGI scripts, right?

If you are using Apache you can sidestep the entire ENV variable issue
by adding entries to Apache's httpd.conf file:

SetEnv SYBASE=/opt/sybase-12.5

Now every CGI script will have the SYBASE env. variable set correctly.

Michael Peppler / / / ZetaTools, Inc /
ZetaTools: Call perl functions as Sybase stored procedures!