[plug] Perl Module calling problem

Brian Tombleson brian at paradigmit.com.au
Thu Jan 17 00:30:44 WST 2002


From: "Kyle Hargraves" <kh at nelson.hedland.edu.au>
> Just out of interest how can the INC be modified to include other
> directories - in a source file

[partly guessing]

You can do a
  push(@INC,"/path/to/INC/dir");
.. this literally shoves the dir on the end of the INC list for this script
only (not the whole environment).  This is because @INC is a built-in array
like @ARGV and populated on startup by the environment.

You could also do things like ..
use lib "/path/to/lib/dir";
.. to add a lib dir for latter searching by commands like ..
require "MyPM.pm";
 .. which essentially looks for the /path/to/lib/dir/MyPM.pm file (after
searching for MyPM.pm in the other lib dirs).
But this avoids the @INC issue altogether (for better or for worse - YMMV).

If I've got this wrong, I'd appreciate someone letting me know as well.
Perl doco is not particularly well sorted or searchable :( .. or maybe
there's just too much of it in one hit. :-)

HTH

- Brian.



More information about the plug mailing list