Reputation: 2462
I made myself a custom PERL module and it works when called by a script in the same directory, but not from outside the directory for somewhat obvious reasons. How do I use the module without installing it? eg:
use 5.012;
use warnings;
use Y:/my/dir/to/module.pm;
Upvotes: 5
Views: 10134
Reputation:
If you only have one module, instead of using lib, you can do this :
BEGIN {
unshift @INC,"dir";
#@INC is the directory list, where perl searches for .pm files
}
use Foo::Bar; #dir/Foo/Bar.pm
#or
do "dir/Foo/Bar.pm"; #perldoc -f do
Upvotes: 0
Reputation: 3744
use lib 'Y:/my/dir/to';
use module; # BAD name for module, lowercase is reserved for pragmas...
Upvotes: 7