x0u9ow
Last Updated: February 25, 2016
·
973
· creaktive
F93e90d4db9dc0eb3b5681c6fccfa0e2

CPAN dependency hell, reloaded

Perl community has gone a long way when it comes to handling module dependencies. Any package downloaded from CPAN/DarkPAN mirror can be easily deployed among it's recursive dependencies using the excellent cpanm utility by Tatsuhiko Miyagawa.
However, not every package play that nice. Several cool Perl projects on GitHub instruct user how to install individual dependencies by hand. That's perfectly fine in 99% of usage cases. But we, Perl geeks who use perlbrew to keep multiple Perl environments, are not fine with a non-automated way of tracking dependencies.
Enter the Perl::PrereqScanner:

$ scan_prereqs -c project-path/ | awk '{print $1}' | cpanm

Not a perfect way, as it will try to match internal package names against CPAN (think someone creating a Test.pm module). But still far superior to the quick & dirty ack hack I used before:

$ ack --perl --output '$1' -h '^use\s+([\w:]+)' project-path/ | sort -u

Not to mention abhorrent grep/sed variations :)

Say Thanks
Respond