Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: Do Pure Perl CPAN packages really need to use ExtUtils::Command::MM?

by ELISHEVA (Prior)
on Feb 18, 2011 at 00:27 UTC ( [id://888827]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Do Pure Perl CPAN packages really need to use ExtUtils::Command::MM?
in thread Do Pure Perl CPAN packages really need to use ExtUtils::Command::MM?

I want to ++ this a thousand times tonight. This worked! I totally missed the "MY::post_initialize" when I was reading the docs and studying the source code yesterday.

I had to modify it slightly so I didn't clobber the user's settings. Some people install CPAN software into their home dir and may be using PERL5LIB to add those to their module search path.

use File::Spec; use Config; sub MY::post_initialize { my $sInc = File::Spec->rel2abs('inc', $ENV{PWD}); my $sSep = $Config{path_sep}; my $PERL5LIB=$ENV{PERL5LIB}; return "PERL5LIB := $PERL5LIB$sSep$sInc"; }

Update: After grepping through the code one more time I found where this is documented:ExtUtils::MM::Unix. I do remember reading it yesterday, but when I read the documentation I didn't connect the dots:

Returns an empty string per default. Used in Makefile.PLs to add some chunk of text to the Makefile after the object is initialized.

The object, what object? Thanks once again.

Update: added comment about portable way to append paths to PERL5LIB

Update: updated with resolution portability issue

  • Comment on Re^4: Do Pure Perl CPAN packages really need to use ExtUtils::Command::MM?
  • Download Code

Replies are listed 'Best First'.
Re^5: Do Pure Perl CPAN packages really need to use ExtUtils::Command::MM?
by Anonymous Monk on Feb 18, 2011 at 01:43 UTC

      Can you name a specific platform where setting PERL5LIB in the makefile will be invisible to perl called from within the makefile?

      blib/ExtUtils::testlib simply adds cwd()/blib/arch and cwd()/blib/lib to @INC. "make test" already puts those in @INC. To eliminate the tension between MakeMaker and ModuleBuild without placing all sorts of stuff in the project root, I would need a portable way to get ExtUtils::MakeMaker to put "projectroot/inc", a directory used by [mod://Module::Build], into @INC.

        Can you name a specific platform where setting PERL5LIB in the makefile will be invisible to perl called from within the makefile?

        make syntax isn't exactly universal. Does your syntax work with gmake/dmake/nmake/make/mingw32-make... perl -V:make?

        I would need a portable way to get ExtUtils::MakeMaker to put "projectroot/inc

        use the module inc, it is independent of its father Module::Install

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://888827]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-23 06:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found