CPANPLUS::Shell::Default::Plugins::Prereqs

domm on 2008-10-02T06:57:39

Deep in one of the current threads on autobundling installers, someone (I think Jos) mentioned a hitherto unkown (to me) module called CPANPLUS::Shell::Default::Plugins::Prereqs, which is another very cool plugin for CPANPLUS.

It will give a very nice overview of what other dists a given dist (local or on CPAN) needs, and will even install them. While the last point isn't so revolutionary for regular CPAN stuff, I find it very comfortable for custom code that's not on CPAN. Yes, Module::Install can also do that, but I think it's evil and I really hate make (or rather Makefiles - using tabs for semantics is just fu̷cked)

Examples

~$ cpanp /prereqs show Moose
  Module                            Req Ver  Installed       CPAN  Satisfied
  Test::LongString                        0       0.11       0.11        Yes
  Scalar::Util                         1.18       1.19       1.19        Yes
  Test::Exception                      0.21       0.27       0.27        Yes
  Filter::Simple                          0       0.82       0.82        Yes
  Class::MOP                           0.66       0.65       0.66         No
  ExtUtils::MakeMaker                  6.44       6.44       6.46        Yes
  Sub::Exporter                       0.972      0.980      0.980        Yes
  Carp                                    0       1.08       1.08        Yes
  Test::More                           0.62       0.80       0.80        Yes
  List::MoreUtils                         0       0.22       0.22        Yes

It also works on stuff that's not on CPAN. You just need to chdir into the dir containing Build.PL (of course it also works with Makefile.PL, but no sane person is still using that...)

~$ cd revdev/RevDev-Schema
~/revdev/RevDev-Schema$ cpanp /prereqs show .
  Module                            Req Ver  Installed       CPAN  Satisfied
  DBIx::SchemaChecksum                 0.23       0.23       0.23        Yes
  DBIx::Class                             0    0.08010    0.08010        Yes
  Array::Diff                          0.04       0.04       0.04        Yes
  RevDev::Utils                        0.10       0.12       0.11        Yes
  DBD::Pg                            2.10.0     2.10.5   2.010007        Yes
  Sys::Hostname                           0       1.11       1.11        Yes
  DateTime::Format::Pg                    0    0.16002    0.16002        Yes

And of course it's totally easy to install the dependencies:

~$ cpanp /prereqs install Moose
  Module                            Req Ver  Installed       CPAN  Satisfied
  Test::LongString                        0       0.11       0.11        Yes
...
  Class::MOP                           0.66       0.65       0.66         No
Running [/opt/perl5.10/bin/perl /opt/perl5.10/bin/cpanp-run-perl /home/domm/.cpanplus/5.10.0/build/Class-MOP-0.66/Makefile.PL ]...
Testing if you have a C compiler
Checking if your kit is complete...
Looks good
Writing Makefile for Class::MOP
...
Result: PASS
  ExtUtils::MakeMaker                  6.44       6.44       6.46        Yes
...

Another very sharp tool in my deployment toolbox. MGRIMES++


In defense of Module::Install...

Alias on 2008-10-03T01:57:34

... it recommends AGAINST the use of auto_install() and I even tried to remove the feature altogether (but it didn't stick, too many things broke).