Hi! Please consider following me on twitter: @hanekomu.
2010年07月16日
Modern Perl administration tools
I'm probably preaching to the choir (the phrase we use in German is more
like "bringing owls to Athens") and I'm certainly not saying anything new here,
but I would like to talk about two modern tools that make working with Perl
versions and CPAN distributions very easy: perlbrew and
cpanm.
perlbrew
perlbrew (see App::perlbrew) automates
building and installing various perl versions in the user's home directory.
curl -LO http://xrl.us/perlbrew chmod +x perlbrew ./perlbrew install
With this, perlbrew installs itself to ~/perl5/perlbrew. Now
you can do (and I'm quoting from the App::perlbrew documentation):
# Initialize perlbrew init # Install some Perls perlbrew install perl-5.12.1 perlbrew install perl-5.8.1 perlbrew install perl-5.11.5 # See what were installed perlbrew installed # Switch perl in the $PATH perlbrew switch perl-5.12.1 perl -v # Switch to another version perlbrew switch perl-5.8.1 perl -v # Switch to a certain perl executable not managed by perlbrew. perlbrew switch /usr/bin/perl # Or turn it off completely. Useful when you messed up too deep. perlbrew off # Use 'switch' command to turn it back on. perlbrew switch perl-5.12.1
cpanm
cpanm is a script to get, unpack, build and install modules
from CPAN. It does so in pretty much the simplest way possible, without
dependencies or configuration.
To install it onto a freshly brewed perl, use this command:
curl -L http://cpanmin.us/ | perl - App::cpanminus
Then you can do (and again, I'm quoting from the App::cpanminus documentation):
cpanm Test::More # install Test::More cpanm MIYAGAWA/Plack-0.99_05.tar.gz # full distribution path cpanm http://example.org/LDS/CGI.pm-3.20.tar.gz # install from URL cpanm ~/dists/MyCompany-Enterprise-1.00.tar.gz # install from a local file cpanm --interactive Task::Kensho # Configure interactively cpanm . # install from local directory cpanm --installdeps . # install all deps for the current dir cpanm -L extlib Plack # install Plack and its deps to extlib cpanm --mirror http://cpan.cpantesters.org/ DBI # use the fast-syncing mirror
The cpanm --installdeps . command will work if you have a
Makefile.PL or a Build.PL in the current directory,
but if you use Dist::Zilla you're likely to use a plugin
that generates the Makefile.PL and the dependencies for you. In
that case you can use this:
dzil listdeps | cpanm --skip-installed
Another tool that works well with cpanm is
cpan-outdated (see App::cpanoutdated). It will
simply list all the outdated modules' distribution names in a format that can
be directly passed to cpanm:
cpan-outdated | cpanm
There are some modules that I need for every Perl installation that I'm working with, and I've bundled them into Task::BeLike::hanekomu. So after brewing a new version of perl, I'll do:
cpanm Task::BeLike::hanekomu
and get all the absolute necessities like App::Ack, App::Rgit, Devel::NYTProf and so on.
posted at: 15:56 | path: /cpan_gems | permalink | 2 comments | 0 trackbacks
:m) wrote at 2010-07-19 14:21:
thank you. I was not able to brew a 5.8.1, but 5.8.9 was successful. Perhaps include a link to an online directory where users can browse for available versions of perl.
Comments are closed for this story.
Trackbacks are closed for this story.
john napiorkowski wrote at 2010-07-16 17:48: