[pm-h] How to update @INC from within a script?

Matt Sisk sisk at mojotoad.com
Tue Dec 6 03:10:02 PST 2005

Quoting Kristofer Hoch <kristoferhoch at yahoo.com>:
>     Try this at the very top of your script
>   #!/path/to/perl
>   BEGIN { push(@INC, '/path/to/DBI/directory'); }

Most recent versions of perl (I'm not sure when it was added, but definitely
present in the 5.8 series) allow the 'lib' pragma:

  use lib '/path/to/DBI/dir';

Aside from not having to type BEGIN blocks, this also automatically adds
$dir/$archname/auto directories if they are present so that you include your XS
components if present.


More information about the Houston mailing list