System setup for modern perl projects
Some helpful tips in making your perl projects more portable.
Don't use the system perl installed with your operating system, instead the latest stable perl via perlbrew:
curl -L http://install.perlbrew.pl | bash perlbrew install stable
The App::cpanminus and local::lib provide a lot of help here. To install these with a single command under your normal system account, run the following:
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
curl -L http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
Don't install modules with a perl version, instead in them in a per user, project or other directory using local::lib. This allows modules to be installed without being root and different projects can use different versions of the same module if needed.
Then add to your bash profile:
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.bash_profile echo 'export PATH=~/perl5/bin:$PATH' >> ~/.bash_profile
Activate for the current session without having to re-login:
Then add the following to your scripts in order for perl to find your projects' modules:
use FindBin qw/$Bin/; use local::lib "$Bin/../local";
The standard CPAN shell uses a fair amount of memory, this can be a problem if running from small virtual machines, use cpanminus as the standard CPAN module is overkill for just adding/removing modules.
cpanm -U HTML::Form::XSS
Use Carton for application dependencies, it also ensures that the same version of modules are installed consistently with its snapshot feature.
Create an example dependency list:
echo "requires 'Acme::Time::Baby';" >> cpanfile
Install modules listed in
Last updated: 07/02/2015