[sf-perl] @INC

Loo, Peter # PHX Peter.Loo at source.wolterskluwer.com
Wed Aug 16 12:26:10 PDT 2006


Hi Michael and Michael,

Still does not work.

$ cat ./testCon.pl
#!/usr/bin/perl -w

use DBI;

my $dbh = DBI->connect("dbi:Oracle:instance", "my_id", "my_pass", {
RaiseError => 1 });

$dbh->disconnect();

exit;

$ ./testCon.pl    
Can't locate DBI.pm in @INC (@INC contains:
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/5.8.3/sun4-solaris /usr/local/lib/perl5/5.8.3
/usr/local/lib/perl5/site_perl/5.8.3/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.3 /usr/local/lib/perl5/site_perl .)
at ./testCon.pl line 3.
BEGIN failed--compilation aborted at ./testCon.pl line 3.

$ env | grep PERL5LIB
PERL5LIB=:/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris 

Peter

-----Original Message-----
From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org
[mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or
g] On Behalf Of Michael Friedman
Sent: Wednesday, August 16, 2006 11:59 AM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] @INC

At my office, we store our code in CVS, so each developer has their own
copy of our custom modules. To make that work we couldn't use 'use lib'
because we didn't want to edit the files everytime. Instead we use
PERL5LIB, the environment variable.

Perl adds any dirs in PERL5LIB into your @INC before running any script.
(See `man perlrun`.)

However, as the perlrun page points out, this is inherently insecure, so
don't try it if you are checking for taint, running on a shared machine,
etc. etc.

-- Mike

PS - You can also unshift dirs directly onto @INC, but that's the brute
force approach.

On Aug 16, 2006, at 11:47 AM, Michael Budash wrote:

>        use lib '/path/to/the/modules';
>
> is the preferable way to do this
>
> On Aug 16, 2006, at 11:35 AM, Loo, Peter # PHX wrote:
>
>> Hi All,
>>
>> Will someone please tell me how I can add the Perl Modules in @INC so

>> that I can reference the using use statement?
>>
>> Thanks.
>>
>> Peter
>> _______________________________________________
>> SanFrancisco-pm mailing list
>> SanFrancisco-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
> --
> Michael Budash
> Michael Budash Consulting
> michael at budashconsulting.com
> 707-252-7670 off
> 707-363-4262 cel
>
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm

---------------------------------------------------------------------
Michael Friedman                     HighWire Press
Phone: 650-725-1974                  Stanford University
FAX:   270-721-8034                  <friedman at highwire.stanford.edu>
---------------------------------------------------------------------


_______________________________________________
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
http://mail.pm.org/mailman/listinfo/sanfrancisco-pm


This E-mail message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not
the intended recipient, please contact the sender by reply E-mail, and
destroy all copies of the original message.


More information about the SanFrancisco-pm mailing list