Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday December 21, 2007
05:30 AM

ExtUtils::MakeMaker and Debugging Makefiles

[ #35178 ]

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:


# setup cpan

# 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

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/perl5lib /

This shouldn't be hard, but it is :( Oh, and I guess that doesn't account for architecture dependent files.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Smolder does this too (and it stole the code/ideas from Krang). Feel free to borrow them as you'd like:

    It's done by the smolder_build script which uses the Smolder::Platform module. You're probably most interested in the build_perl_module() sub.

    I don't know if you deal with different platforms in your build, but Smolder and Krang do. If something needs to be changed for a certain platform then that's overridden in a subclass of Smolder::Platform that's loaded by smolder_build.

    http://smolder.svn.sourceforge. []
  • I'm not sure I exactly understand the problem, but might local::lib solve this? It sounds too simple, but it just sets:

    export MODULEBUILDRC=/home/username/perl/.modulebuildrc export PERL_MM_OPT='INSTALL_BASE=/home/username/perl' export PERL5LIB='/home/username/perl/lib/perl5:/home/username/perl/lib/perl5/i386-linux ' export PATH="/home/username/perl/bin:$PATH"