PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at mbay dot net>
Subject: Re: perl and LD_LIBRARY_PATH
Date: Dec 12 1997 11:20PM

Paul S R Chisholm wrote:
> 
> Katherine Marsden wrote:
> > $ENV{LD_LIBRARY_PATH} .= "/usr/local/system10/lib:$ENV{LD_LIBRARY_PATH};
> >
> > use Sybase::DBlib;
> 
> Not tested:
> 
> BEGIN {
>     $ENV{LD_LIBRARY_PATH} = "/usr/local/system10/lib:$ENV{LD_LIBRARY_PATH}";
> }
> 
> use Sybase::DBlib;
> 
> ... because "use" happens *before* the first executable statement, as
> if it was a "require" inside a "BEGIN" block. Setting a variable inside
> a "BEGIN" block that's *before* the "use" will work.

You are correct in saying that any environment changes that need to 
be made for the Sybase libs should be done in a BEGIN block before
the "use Sybase::DBlib".

However, LD_LIBRARY_PATH is not one of them, because you need to 
affect the way ld.so works, and that can only be done for child
processes.

So to reiterate: LD_LIBRARY_PATH needs to be set *before* the
program that needs it is started. For perl scripts this usually
involves writing a small shell wrapper, or making sure that that
info is in the environment through some other means, or 
possibly using the exec trick I outlined in my other message,
although I have not verified that that actually works.

Michael
--
Michael Peppler       -||-  Data Migrations Inc.
mpeppler@datamig.com  -||-  http://www.mbay.net/~mpeppler