SPUG: add to default @INC
Creede Lambard
creede at penguinsinthenight.com
Fri Jul 18 16:12:32 CDT 2003
'use lib' is the way to go.
#!/usr/bin/perl
use lib '/path/to/my/perl/directory';
Or, you can set the PERL5LIB environment variable if your're on a
Unix-ish machine (maybe even on Windows, I've never tried).
-- Creede
On Fri, 18 Jul 2003 ced at carios2.ca.boeing.com wrote:
> > I am wondering how to add a couple more pathes to the default @INC. This i
> > not adding to @INC with your script. For example when I run the following
> > command I would like to see the directory /foo in the list.
>
> > $ perl -e 'print $_ ."\n" foreach @INC'
> > /usr/lib/perl5/5.8.0/i386-linux-thread-multi
> > /usr/lib/perl5/5.8.0
> > /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
> > /usr/lib/perl5/site_perl/5.8.0
> > /usr/lib/perl5/site_perl
> > /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
> > /usr/lib/perl5/vendor_perl/5.8.0
> > /usr/lib/perl5/vendor_perl
> > /usr/lib/perl5/5.8.0/i386-linux-thread-multi
> > /usr/lib/perl5/5.8.0
>
> You could standard suggestions: perldoc -q 'add a directory'
> or maybe:
>
> BEGIN{ unshift @INC => '/foo' }
>
> But see the mentioned faq for path benefits of 'use lib' pragma.
>
> Rgds,
> --
> Charles DeRykus
More information about the spug-list
mailing list