modules-post-icon

Sometimes you stumble across some perl that you want to run, but it's not neatly packaged as a cpan dist and doesn't have a nice list of modules to get it going.


Often it's an email or IRC conversation witha gist or pastebin link to some perl they're working on.

  • You can run the script a couple of times, installing missing depends as you go
  • You can ask the author
  • You can rely on your amazing tooling to get you the right versions of the modules.

Go get cpan-minus

It's the one after cpanplus, except it's lighter because it has fewer oddball features.

If you don't have cpanm you can bootstrap it from http://cpanmin.us with:

% curl -L https://cpanmin.us | perl - App::cpanminus

cpanm knows how to install cpanm.

me@compy386:~ cpanm $( 
    perl -nle '
    /use ([:\w]+) ([0-9.]+)/ and $d{$1} = $2  
    }{
    printf "%s@%s ", $_, $d{$_} for keys %d' -- shell-only  
)

On My machine it just prints this:

Object::Tiny::RW is up to date. (1.07)
AnyEvent::ReadLine::Gnu is up to date. (1.0)
AnyEvent is up to date. (7.11)

The one-liner produces this:

 AnyEvent@7.11 Object::Tiny::RW@1.07 AnyEvent::ReadLine::Gnu@1.0 

We just match use Letters::And::Colons space numbers and stash them.

If you replace cpanm with echo, you'll see that we print out the module names and versions in the form Object::Tiny::RW@1.07, the format cpanm likes.