Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: module needs another module for build

by bingos (Vicar)
on Aug 09, 2011 at 22:45 UTC ( #919571=note: print w/ replies, xml ) Need Help??


in reply to module needs another module for build

build_requires will be resolved too late to be of any help. build_requires are resolved by *after* Makefile.PL has already been executed by cpan/cpanp/cpanm etc.

CONFIGURE_REQUIRES on the other hand are a list of prereqs that must be resolved *before* Makefile.PL is executed.

  • CONFIGURE_REQUIRES - modules required by Makefile.PL/Build.PL
  • BUILD_REQUIRES - modules required only during the build process
  • PREREQ_PM - modules required to run your module
WriteMakefile( CONFIGURE_REQUIRES => { 'B' => 0, }, PREREQ_PM => { 'B' => 0, }, )

We require the 'B' module during configuration and at runtime in the above example.


Comment on Re: module needs another module for build
Download Code
Re^2: module needs another module for build
by dk (Chaplain) on Aug 10, 2011 at 08:19 UTC
    Thank you! CONFIGURE_REQUIRES is definitely a step forward, will try. I wonder if CPAN shell can detect that this field has changed after Makefile.PL was run and re-run it, because I have another module that does just that, if none of the libraries it needs are found, it falls back on a third-party module.

      The CPAN clients (cpan/cpanp/cpanm) take the following steps:

      • Download distribution
      • Extract distribution
      • Does a META.yml or META.json file exist? Okay, parse and look for configure_requires, resolve all the requirements listed there
      • Execute Makefile.PL or Build.PL
      • If there is a MYMETA.yml or MYMETA.json, parse and look for build and runtime requirements, resolve these
      • No, MYMETA files, okay, if there is a Makefile parse that to resolve requirements
      • Oh, its a Module::Build based dist, try running 'Build prereq_data' action, if that fails, poke around in _build/ directory to find the requirements
      • Resolve requirements
      • Execute 'make' for EUMM or './Build' for M::B
      • Execute 'make test' for EUMM or './Build test' for M::B
      • Execute 'make install' for EUMM or './Build install' for M::B
        ++ very useful , thanks. This should be in FAQ somewhere.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-12-27 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls