How to set LD_LIBRARY_PATH

2010-05-28 Thread newbie01 perl
Hi all,

Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?

If I set LD_LIBRARY_PATH from the command line, all is okay

[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
Can't load
'/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: libclntsh.so.11.1: cannot open shared object file:
No such file or directory at
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at -e line 1
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
[oracle ~]$ export LD_LIBRARY_PATH=/oracle/product/db/11.1/lib
[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
1.15

But if I do the following instead in the Perl script, it does not work? How
to set the LD_LIBRARY_PATH then?

$ENV{ORACLE_HOME}=$ORACLE_HOME;
$ENV{ORACLE_SID}=$ORACLE_SID;
$ENV{PATH}=$ORACLE_HOME/bin:$PATH;
$ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;

FYI, the script is to run from a cron which is why am setting
LD_LIBRARY_PATH in the script.

Any response will be very much appreciated. Thanks in advance.


Re: How to set LD_LIBRARY_PATH

2010-05-28 Thread Michael Ludwig
Am 28.05.2010 um 09:45 schrieb newbie01 perl:

 Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?

 But if I do the following instead in the Perl script, it does not work? How
 to set the LD_LIBRARY_PATH then?
 
 $ENV{ORACLE_HOME}=$ORACLE_HOME;
 $ENV{ORACLE_SID}=$ORACLE_SID;
 $ENV{PATH}=$ORACLE_HOME/bin:$PATH;
 $ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;

Try putting the %ENV adjustment in a BEGIN block that executes before you load 
the Oracle driver.

 FYI, the script is to run from a cron which is why am setting
 LD_LIBRARY_PATH in the script.


You could do one of two things instead of tweaking %ENV in your Perl script:

(1) In your crontab, set the variables in the cronline:

* * * ... BLA=eins BLUB=zwei /usr/local/bin/script.pl

(2) Call a shell script from the crontab that sets up the environment for your 
Perl script and then calls it.

I'd go for (2).

-- 
Michael.Ludwig (#) XING.com



Re: How to set LD_LIBRARY_PATH

2010-05-28 Thread John Scoles
You will have to set those values before your modules load.

So you should stick them in the BEGIN and that should work

http://www.compuspec.net/reference/language/perl/BEGIN_and_END.shtml

cheers
John Scoles

On Fri, May 28, 2010 at 3:45 AM, newbie01 perl newbie01.p...@gmail.comwrote:

 Hi all,

 Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?

 If I set LD_LIBRARY_PATH from the command line, all is okay

 [oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
 Can't load

 '/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so'
 for module DBD::Oracle: libclntsh.so.11.1: cannot open shared object file:
 No such file or directory at
 /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
 at -e line 1
 Compilation failed in require at -e line 1.
 BEGIN failed--compilation aborted at -e line 1.
 [oracle ~]$ export LD_LIBRARY_PATH=/oracle/product/db/11.1/lib
 [oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
 1.15

 But if I do the following instead in the Perl script, it does not work? How
 to set the LD_LIBRARY_PATH then?

 $ENV{ORACLE_HOME}=$ORACLE_HOME;
 $ENV{ORACLE_SID}=$ORACLE_SID;
 $ENV{PATH}=$ORACLE_HOME/bin:$PATH;
 $ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;

 FYI, the script is to run from a cron which is why am setting
 LD_LIBRARY_PATH in the script.

 Any response will be very much appreciated. Thanks in advance.


--
Catch Alex  Sheeri at ODTUG/Kaleidoscope - June 27 - July 1. 
Hear Sheeri speak or email eve...@pythian.com to meet with Pythian.


Re: How to set LD_LIBRARY_PATH

2010-05-28 Thread Shlomi Fish
On Friday 28 May 2010 10:45:14 newbie01 perl wrote:
 Hi all,
 
 Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?
 
 If I set LD_LIBRARY_PATH from the command line, all is okay
 
 [oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
 Can't load
 '/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi
 /auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.11.1:
 cannot open shared object file: No such file or directory at
 /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
 at -e line 1
 Compilation failed in require at -e line 1.
 BEGIN failed--compilation aborted at -e line 1.
 [oracle ~]$ export LD_LIBRARY_PATH=/oracle/product/db/11.1/lib
 [oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
 1.15
 
 But if I do the following instead in the Perl script, it does not work? How
 to set the LD_LIBRARY_PATH then?
 
 $ENV{ORACLE_HOME}=$ORACLE_HOME;
 $ENV{ORACLE_SID}=$ORACLE_SID;
 $ENV{PATH}=$ORACLE_HOME/bin:$PATH;
 $ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;
 
 FYI, the script is to run from a cron which is why am setting
 LD_LIBRARY_PATH in the script.
 

If you're going to use use DBD::Oracle; in the script then you'll need to 
put these statements in a BEGIN block:

[code]
use vars qw($ORACLE_HOME $ORACLE_SID);

BEGIN
{
$ORACLE_HOME = ...;
$ORACLE_SID = ...;
$ENV{ORACLE_HOME}=$ORACLE_HOME;
$ENV{ORACLE_SID}=$ORACLE_SID;
$ENV{PATH}=$ORACLE_HOME/bin:$PATH;
$ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;
}

use DBD::Oracle;
[/code]

That's because use is executed at compile-time instead of run-time.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
The Human Hacking Field Guide - http://shlom.in/hhfg

God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Re: How to suss out module dependencies...

2010-05-28 Thread Bruce Sears
One difference with what I did is that mine determines if the mod is a 
core mod and does not list it, if so.  I was trying to parse through all 
of our homegrown packages and see what non-core mods (and versions) they 
depended on.  didn't spend a lot of time making it prettier, so some 
calls were system calls to start perl within perl (seems yucky) and 
parsing STDOUT response, but it seemed to do the job, so it remained 
ugly...  I agree with Dave about the fact that your setup should not 
need to be CPAN compliant in order for you to still get the dependeny 
list you want if you use CPAN::FindDependencies. 


bruce

David McMath wrote:
We dealt with a similar problem, moving from comfortable old server to 
a shiny new one.  Perlmonks had some interesting advice:


http://perlmonks.org/?node_id=203148

which I think is pretty cool (even though I only barely understand 
what it's going).


One of our folks ended up, though, using the CPAN::FindDependencies 
module and writing some stuff that walks up through our use statements 
until it finds something that's not ours, then asks CPAN.  You mention 
you're not using the normal CPAN model, but FindDependencies acutally 
goes back to a cpan site to get its answers, so maybe that's OK.


Maybe this is helpful,

dave

William Bulley wrote:

I have a question for which I have not been able to find a good answer.

I have a Perl application that uses many Perl modules.  Most come from
CPAN, some I have written, others come with Perl distributions (core?).

I am faced with the need to transport this collection of Perl code from
operating system A to operating system B, both of which are perfectly
well supported by Perl.  Over several months I have added to system A
lots of modules that need other modules.

Unfortunately, system B is rather devoid of most of the modules that I
need for this application.  I dread having to make an inclusive list of
all the modules and all the modules that those modules need, and so on,
and so on.

This is something that CPAN does when I install a new module that has
dependencies on other modules.  BUT in my case I am NOT using the blib,
lib, t, MANIFEST, etc., etc., distribution model of CPAN, so I cannot
use those tools - including several others on CPAN that compliment or
implement this functionality.

So my question is: is there a way to ask the Perl compiler/interpreter
to spit out all the modules (and the other dependent modules) in my
application in some format (a structured tree, a linear text file, 
etc.)?


Failing that, are there some external tools that can accomplish this
given my main module as a starting point?  Thank you in advance.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


RE: How to set LD_LIBRARY_PATH

2010-05-28 Thread Martin Gainty

A workaround for LD_LIBRARY_PATH for me is to locate my Java jvm.dll in 
$JRE_BIN/bin/server and the resource dlls are in $JRE_HOME/bin
the other libraries are on $PATH


Martin Gainty 

 

Nimziki:Rabbi i'm not jewish..

Rabbi Levison: ..Nobody's Perfect..

 

(excerpt from movie Independence Day)
__ 
Note de déni et de confidentialité

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.



 

 From: shlo...@iglu.org.il
 To: beginn...@perl.org
 Subject: Re: How to set LD_LIBRARY_PATH
 Date: Fri, 28 May 2010 11:06:41 +0300
 CC: newbie01.p...@gmail.com; dbi-users@perl.org
 
 On Friday 28 May 2010 10:45:14 newbie01 perl wrote:
  Hi all,
  
  Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?
  
  If I set LD_LIBRARY_PATH from the command line, all is okay
  
  [oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
  Can't load
  '/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi
  /auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.11.1:
  cannot open shared object file: No such file or directory at
  /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
  at -e line 1
  Compilation failed in require at -e line 1.
  BEGIN failed--compilation aborted at -e line 1.
  [oracle ~]$ export LD_LIBRARY_PATH=/oracle/product/db/11.1/lib
  [oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
  1.15
  
  But if I do the following instead in the Perl script, it does not work? How
  to set the LD_LIBRARY_PATH then?
  
  $ENV{ORACLE_HOME}=$ORACLE_HOME;
  $ENV{ORACLE_SID}=$ORACLE_SID;
  $ENV{PATH}=$ORACLE_HOME/bin:$PATH;
  $ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;
  
  FYI, the script is to run from a cron which is why am setting
  LD_LIBRARY_PATH in the script.
  
 
 If you're going to use use DBD::Oracle; in the script then you'll need to 
 put these statements in a BEGIN block:
 
 [code]
 use vars qw($ORACLE_HOME $ORACLE_SID);
 
 BEGIN
 {
 $ORACLE_HOME = ...;
 $ORACLE_SID = ...;
 $ENV{ORACLE_HOME}=$ORACLE_HOME;
 $ENV{ORACLE_SID}=$ORACLE_SID;
 $ENV{PATH}=$ORACLE_HOME/bin:$PATH;
 $ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;
 }
 
 use DBD::Oracle;
 [/code]
 
 That's because use is executed at compile-time instead of run-time.
 
 Regards,
 
 Shlomi Fish
 
 -- 
 -
 Shlomi Fish http://www.shlomifish.org/
 The Human Hacking Field Guide - http://shlom.in/hhfg
 
 God considered inflicting XSLT as the tenth plague of Egypt, but then
 decided against it because he thought it would be too evil.
 
 Please reply to list if it's a mailing list post - http://shlom.in/reply .
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

DBD::ODBC 1.24_1 development bug fix release

2010-05-28 Thread Martin Evans
Due to annoying bug a few people are hitting when re-executing a
prepared statement with MS SQL Server I've uploaded 1.24_1 development
release. Changes since 1.24 are:

Corrected pod and private attributes for the odbc_SQL_DRIVER_ODBC_VER
attribute which was documented as SQL_DRIVER_ODBC_VER.

Added FAQ on pauses on statement destruction when all the result-set
has not been retrieved (mostly freeTDS and MS SQL Server ODBC Driver).

Fixed bug introduced in 1.24 where if you are using MS SQL Server, and
you are preparing, binding placeholders and re-executing multiple
times you may get a Invalid character value for cast specification
error. Thanks to anonymous for spotting this and producing a
standalone example of the problem that made it so much easier to find.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com


Re: How to set LD_LIBRARY_PATH

2010-05-28 Thread jonathan . leffler
The dynamic loader read LD_LIBRARY_PATH when (before?) Perl gets going.  AFAIK, 
it doesn't reread it,  so changing it in Perl code is too late unless you set 
it and exec your code again (which is basically saying it is too late).

I'm tolerably certain this applies to Solaris; I think it applies elsewhere too.

JL


Sent from my BlackBerry® smartphone, powered by CREDO Mobile.

-Original Message-
From: newbie01 perl newbie01.p...@gmail.com
Date: Fri, 28 May 2010 19:45:14 
To: beginnersbeginn...@perl.org; dbi-usersdbi-users@perl.org
Subject: How to set LD_LIBRARY_PATH

Hi all,

Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?

If I set LD_LIBRARY_PATH from the command line, all is okay

[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
Can't load
'/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: libclntsh.so.11.1: cannot open shared object file:
No such file or directory at
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at -e line 1
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
[oracle ~]$ export LD_LIBRARY_PATH=/oracle/product/db/11.1/lib
[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
1.15

But if I do the following instead in the Perl script, it does not work? How
to set the LD_LIBRARY_PATH then?

$ENV{ORACLE_HOME}=$ORACLE_HOME;
$ENV{ORACLE_SID}=$ORACLE_SID;
$ENV{PATH}=$ORACLE_HOME/bin:$PATH;
$ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;

FYI, the script is to run from a cron which is why am setting
LD_LIBRARY_PATH in the script.

Any response will be very much appreciated. Thanks in advance.



Re: How to set LD_LIBRARY_PATH

2010-05-28 Thread Oscar Gomez
create shell script, first set enviroment variables Oracle then  
execute  script perl


jonathan.leff...@gmail.com escribió:

The dynamic loader read LD_LIBRARY_PATH when (before?) Perl gets going.  AFAIK, 
it doesn't reread it,  so changing it in Perl code is too late unless you set 
it and exec your code again (which is basically saying it is too late).

I'm tolerably certain this applies to Solaris; I think it applies elsewhere too.

JL


Sent from my BlackBerry® smartphone, powered by CREDO Mobile.

-Original Message-
From: newbie01 perl newbie01.p...@gmail.com
Date: Fri, 28 May 2010 19:45:14 
To: beginnersbeginn...@perl.org; dbi-usersdbi-users@perl.org

Subject: How to set LD_LIBRARY_PATH

Hi all,

Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?

If I set LD_LIBRARY_PATH from the command line, all is okay

[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
Can't load
'/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: libclntsh.so.11.1: cannot open shared object file:
No such file or directory at
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at -e line 1
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
[oracle ~]$ export LD_LIBRARY_PATH=/oracle/product/db/11.1/lib
[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,\n;'
1.15

But if I do the following instead in the Perl script, it does not work? How
to set the LD_LIBRARY_PATH then?

$ENV{ORACLE_HOME}=$ORACLE_HOME;
$ENV{ORACLE_SID}=$ORACLE_SID;
$ENV{PATH}=$ORACLE_HOME/bin:$PATH;
$ENV{LD_LIBRARY_PATH}=$ORACLE_HOME/lib;

FYI, the script is to run from a cron which is why am setting
LD_LIBRARY_PATH in the script.

Any response will be very much appreciated. Thanks in advance.