Re: I have a weird issue with a script running under cron

Bruce Johnson <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On Feb 18, 2014, at 10:47 AM, John D Groenveld <[email protected]> wrote:

> In message <[email protected]>, Bruce J
> ohnson writes:
>> Via cron (with the Oracle environment variables set as in the script in questi
>> on, please read the OP!):
>> 
>> SHELL=/bin/sh
>> USER=root
>> LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
>> ORACLE_SID=PHMWEB
>> PATH=/usr/bin:/bin
>> PWD=/root
>> HOME=/root
>> SHLVL=2
>> LOGNAME=root
>> ORACLE_HOME=/usr/lib/oracle/11.2/client64
>> 
>> 
>> 	linux-vdso.so.1 =>  (0x00007fff33dff000)
>> 	libocci.so.11.1 => /usr/lib/oracle/11.2/client64/lib/libocci.so.11.1 (0
>> x
>> 00007ff92b1e0000)
>> 	libclntsh.so.11.1 => /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.
>> 1
>> (0x00007ff92894e000)
> 
> 
> /tmp/test.sh
> #!/bin/ksh
> export ORACLE_HOME
> ORACLE_HOME=/usr/lib/oracle/11.2/client64
> /tmp/dbi.pl
> 
> 
> /tmp/dbi.pl
> #!/usr/local/bin/perl -w
> use DBI;
> my $dbh = DBI->connect( "dbi:Oracle:PHMWEB", "scott", "tiger",
>                       { RaiseError => 1 } );
> $dbh->disconnect;
> 
> 
> $ /bin/env -i /tmp/test.sh
> 
> John
> [email protected]

This is functioning, since no errors came up.

One quick perl-related question, though…what environment do perl modules imported via ‘use module;’ commands have? I would think it was the environment of the importing program.

One of the use statements has an exported function that checks something in the database, and there is a db connection made if the function is called. The error line number doesn’t make sense, since the error refers to the line making my db connection in the main script, and doesn’t correspond to an existing line in the perl module, but I’ve run into oddball misdirections in perl error statements in the past.

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.