I've been going absolutely nuts trying to debug a CPAN script we use at work. In order to make sure that we have complete control over our dependencies, we bundle them with our application. We do this with a setup_cpan shell script. Unfortunately, it doesn't quite do what we want and many hours of struggle has gotten me closer, but not quite there. To test it, I have a shell script which forces an install of YAML:
#!/usr/bin/bash # setup cpan ./script/setup_cpan.sh # force install YAML perl -I/home/ovid/work/trunk/deps/perl5lib/ /opt/bin/cpan -fi YAML # remove YAML builtin cd deps svn status | grep '^?' | sed -e 's/^?//' | xargs rm -fr for file in `svn status | grep '^M' | sed -e 's/^M//'`; do svn revert $file done
I've bound that to a key in vim which allows me to constantly tweak our setup_cpan script and rerun the configuration. The closest I can get is to set INSTALLDIRS to site, but that gives me this error:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ERROR: Can't create '/opt/lib/perl/site_perl/auto/YAML' Do not have write permissions on '/opt/lib/perl/site_perl/auto/YAML' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
&ExtUtils::Install::install gets the following first argument:
$VAR1 = { 'blib/arch' => '/opt/lib/perl/site_perl', 'blib/lib' => '/home/ovid/work/trunk/deps/perl5lib', 'blib/man3' => '/home/ovid/work/trunk/deps/perl5lib/man/man3', 'read' => '/opt/lib/perl/site_perl/auto/YAML/.packlist', 'blib/script' => '/home/ovid/work/trunk/deps/perl5lib/bin', 'blib/man1' => '/home/ovid/work/trunk/deps/perl5lib/man/man1', 'write' => '/opt/lib/perl/site_perl/auto/YAML/.packlist', 'blib/bin' => '/home/ovid/work/trunk/deps/perl5lib/bin' };
As you can see, the read and write keys are wrong, but after trolling through make files, adding a 'dump' target, reading through ExtUtils::MakeMaker, I'll be damned if I can figure out how to set those correctly. Once I finally figure this out, then I'll have to turn my attention to Module::Build. Oh, now that I look, I see that the man/ and bin/ directories are wrong, too. Sigh.
What we want is the following:
$ROOT/deps/man/man1/ $ROOT/deps/man/man3/ $ROOT/deps/bin/ $ROOT/deps/perl5lib/
This shouldn't be hard, but it is :( Oh, and I guess that doesn't account for architecture dependent files.
I'm not sure I exactly understand the problem, but might local::lib
solve this? It sounds too simple, but it just sets: