Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

how to re-run Makefile.PL under CPAN?

by dk (Chaplain)
on Sep 19, 2007 at 10:49 UTC ( #639859=perlquestion: print w/ replies, xml ) Need Help??
dk has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm working on a module (X) that needs another module (Y) as a dependency, and I'm encountering problems when the module X is installed using CPAN. The problem is that X's Makefile.PL uses some settings from Y when it generates its Makefile. CPAN actually detects the dependencies all right, and asks to download and install Y, but it does not rerun X's Makefile.PL after Y is installed, which results in X's Makefile being wrongly generated.

I was looking into both CPAN documentation and sources and couldn't find anything useful. Has anyone encountered this problem, and possibly a fix for it?

Thanks!

Update: there seems to be a misunderstanding of the question: I'm interested not how to do that myself, but how to teach module X to interact with CPAN in automated (3rd user)/controlled (CPAN testers) environment.

Comment on how to re-run Makefile.PL under CPAN?
Re: how to re-run Makefile.PL under CPAN?
by jettero (Monsignor) on Sep 19, 2007 at 10:53 UTC
    Well, you can always look to get an os-shell in the package directory. I use that from time to time. Sometimes you can just exit the cpan-shell and come back in too, it depends. look is probably what you want.

    -Paul

      I'm not really sure what do you mean. Is look the look(1), "display lines beginning with a given string" one ?

      When I myself am installing modules, surely I can myself run Makefile.PL as much as I want, but I'm talking about automated builds, when 3rd person is installing module X and getting it installed wrong, or CPAN testers reporting failures.

        I'm not really sure what do you mean. Is look the look(1), "display lines beginning with a given string" one ?

        Within the CPAN shell "look" will extract the archive and give you a shell prompt. For example:

        cpan> look Test::Exception Running look for module Test::Exception Trying to open a subshell in the build directory... Working directory is /Users/adrianh/.cpan/build/Test-Exception-0.25 (1/501) ~/.cpan/build/Test-Exception-0.25 mitchum% ls Build.PL Changes MANIFEST META.yml Makefi +le.PL README lib t
Re: how to re-run Makefile.PL under CPAN?
by Joost (Canon) on Sep 19, 2007 at 11:34 UTC
Re: how to re-run Makefile.PL under CPAN?
by xdg (Monsignor) on Sep 19, 2007 at 12:23 UTC
    Update: there seems to be a misunderstanding of the question: I'm interested not how to do that myself, but how to teach module X to interact with CPAN in automated (3rd user)/controlled (CPAN testers) environment.

    Once Makefile.PL runs, I'm pretty sure you can't get CPAN to automatically run it again after a prerequisite installs. Instead, you need to find a way to have the necessary configuration done during the "make" stage. I can see two ways of doing that:

    1. Override ExtUtils::MakeMaker methods to change the generated Makefile such that during "make" you gather and use some configuration data. (Hard)
    2. Use another *.PL file and the PL_FILES argument in Makefile.PL to either generate a module with the information from your prerequisite or to patch your .pm files in blib as necessary. (Easier)

    Alternatively, you might look into using Module::Build, as it makes subclassing Module::Build and overriding methods fairly easy. You could override the ACTION_build method to gather necessary information, act on it, then call the superclass method to continue the build process.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: how to re-run Makefile.PL under CPAN?
by Anonymous Monk on Sep 20, 2007 at 06:38 UTC
    You should never have to rely on another modules Makefile. That module (Y) should retain whatever information you need.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://639859]
Approved by bingos
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2014-07-31 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (253 votes), past polls