Q. Why would you want to do this?
A. Because I am trying to adapt/modularize a program written by another
developer which installs cpanm to a previously-cpanm-free environment
for use in testing. I want to be able to use this program in
environments where cpanm is already installed.
Q. Can you be more specific? What's the program you're trying to
A. It's a program I call 'khwdebug.sh'; sanitized version attached. It
was written by Karl Williamson, an important contributor to the Perl 5
core distribution and to the Perl 5 Porters mailing list, to address
particular bug reports filed on rt.perl.org.
Q. Which bug reports?
A. Long-time Perl contributor Andreas Koenig tests CPAN modules against
Perl 5 blead. When a CPAN distribution known to work on a released
version of Perl 5 suddenly starts to fail tests when run against blead,
a 'perlbug' process generates an RT ticket. The author of the CPAN
distribution gets notified.
But it's often useful for people other than Andreas to try to confirm
the test failure report. Karl Williamson (khw) wrote a program to do
that. It is set up to run on the Perl 5 development server known as
'dromedary' which is donated to us by booking.com. I've started to run
'khwdebug.sh' on dromedary as well.
Q. What good will modularizing this program do?
A. It will enable people who do not have access to the dromedary server
to test CPAN distributions against blead more easily than they can do
now. And it will enable us to determine whether tests are failing on
platforms other than the Linux/x86_64 found on dromedary.
Q. Where does 'cpanm' come into all this?
A. khwdebug.sh builds Perl 5 blead and installs it into a user-specified
testing directory. Example:
./Configure -des -Dusedevel -Uversiononly -Dprefix=$dir -Dman1dir=none
make -j$test_jobs install
khwdebug.sh then downloads the fatpacked version of cpanm from the
network and builds and installs it into the same directory as the blead
wget --no-check-certificate -O- -q http://bit.ly/cpanm |$dir/bin/perl -
Remember: This is happening on a machine where 'cpanm' is not installed
khwdebug.sh then uses that version of 'cpanm' to download a CPAN distro
from a mirror and prepare all its dependencies.
$dir/bin/cpanm --installdeps $module
khwdebug.sh then makes use of the nifty '--look' option to cpanm to open
a sub-shell, change to the directory where the CPAN distro has been
unpacked, and prompt the user to run 'perl Makefile.PL' where the 'perl'
in question is the recently installed blead:
echo "About to cd a work space directory" >&2
echo "From there, run '$dir/bin/perl Makefile.PL'" >&2
echo "And then, probably 'make test'" >&2
$dir/bin/cpanm --look $module
The user then creates a Makefile and runs 'make test' (or similarly if
the distro uses Module::Build). The user can then confirm the test
failure report and perform local debugging. The more confirmations we
get from more platforms, the more we can be sure that we have a real
Q. Alright, so what's the problem with 'cpanm'?
A. When you try to do a bootstrapped installation of the fatpacked
version of 'cpanm', it, not surprisingly, asks if App::cpanminus is
already installed. If cpanm is already installed, then no additional
version is installed into $dir/bin/. But at a certain point,
khwdebug.sh expects to be able to find and use $dir/bin/cpanm. When
that expectation is not meant, khwdebug.sh cannot proceed.
Thank you very much.