Reputation: 1247
I am looking into rewriting a old application in Perl.
Setting up three packages and running subroutines from them makes a lot of sense for what I'm going to be doing, but I'm not very familiar with setting up packages.
I want the packages to be in the same place as my other Perl scripts, i.e. nothing other than scripts in this bin directory will need to call these packages.
My question is how can I point Perl to know where my packages are (and how do I install them in a place other then the default) and is this an okay/smart thing to do?
Upvotes: 1
Views: 76
Reputation: 64939
This is a common task. The PERL5LIB environment variable contains a list of directories to look for a module in. You can also use the the lib
pragma to specify directories a specific script should look for module in:
#!/usr/bin/perl
use strict;
use warnings;
use lib "$ENV{HOME}/lib";
You might also want to look into cpanm
and local::lib
.
Upvotes: 4