SPUG: add to default @INC

ced at carios2.ca.boeing.com ced at carios2.ca.boeing.com
Fri Jul 18 15:51:36 CDT 2003

> 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.

Charles DeRykus

More information about the spug-list mailing list