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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The snippet you showed from your Makefile.PL suggests you're using ExtUtils::MakeMaker. EU::MM provides several hooks that enable you to specify module dependencies for different stages in your module's life.

If you have a dependency that has to be installed before Makefile.PL can run on the target system, you specify it as a CONFIGURE_REQUIRES option. An example of such a need is Math::Prime::FastSieve, where Inline::MakeMaker has to be installed on the target system, as well as a relatively recent version of EU::MM before the target system runs Makefile.PL.

By listing those types of dependencies in a CONFIGURE_REQUIRES parameter, the module author, upon building the distribution tells EU::MM to place a configure_requires section in META.yml and META.json. META.yml is used by the cpan shell (as well as the other common install tools) to determine the dependencies. The cpan shell will see that the CONFIGURE_REQUIRES dependency is there, and will install it before invoking Makefile.PL. CONFIGURE_REQUIRES doesn't affect the makefile, it affects what modules are available to Makefile.PL.

Ok, that's CONFIGURE_REQUIRES. That's not the stage you need to affect. I just mention it as an example. You need to have a dependency in place before the tests are run. There is no TEST_REQUIRES parameter. But there is a BUILD_REQUIRES, which will get the dependency installed in time for the build process. Technically your module is already built before it's tested, but that detail isn't as important.

Of course PREREQ_PM is the final opportunity to list dependencies, but that isn't what you need here, as that parameter is intended to get a module dependency installed, not a testing/building dependency.

My own experience in this area is partially documented in the thread that someone else already identified here: Clean smoke-test install for Inline based modules using Inline::MakeMaker

Just keep in mind the following:

  1. perl Makefile.PL: If you need something installed before this stage, and it's not needed by the module itself, use CONFIG_REQUIRES. This depends on a fairly recent version of EU::MM, so may want to also specify a minimum EU::MM version in your CONFIG_REQUIRES (else target systems will get some non-fatal warnings when the old EU::MM doesn't know what to do with this param -- not important but maybe confusing to users).
  2. make and make test: If you need something installed before this stage, but again it's not needed by the module itself, use BUILD_REQUIRES This also requires a fairly recent version of EU::MM, so if you use BUILD_REQUIRES, you may want to list a minimum version of EU::MM in a CONFIG_REQUIRES section (else the target user will get some non-fatal warnings upon running perl Makefile.PL -- again, not important but maybe confusing to users).
  3. make install: If you need something installed for the module itself to function properly, use PREREQ_PM This option has been around quite awhile, so you don't really need to worry about minimum EU::MM version numbers.

As usual, I'm sure if I've misstated something or left something out another helpful individual here will fill in those blanks. :)


Dave


In reply to Re: How to specify tests dependencies with Makefile.PL? by davido
in thread How to specify tests dependencies with Makefile.PL? by OlegG

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-23 13:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found