Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Dear Monks,

I'm writing a module, and I'm trying to solve a problem how it should require another module for building itself under CPAN shell. In details, my setup is as follows: I'm authoring module A, which uses module B's config, which has all libraries, include paths, etc stuff needed to build A properly. Basically A's Makefile.PL should be very simple code like this:

WriteMakefile( INC => "$B::Config{INC}", LIB => "$B::Config{LIB}", ... )
Trouble is, if B is NOT installed (yet), I can't read B::Config. Currently I'm making a hack: if B cannot be require'd, I'm creating a Makefile where I do list B as a prerequisite, with empty INC and LIB. CPAN then fetches B, builds and installs it, and returns to A, but it doesn't run Makefile.PL again, just issues "make". To work around that, I'm writing a prefix into the makefile that forcibly re-runs Makefile.PL, hoping that this time B will be available.

That works, but the code is cumbersome, and I'd like to know if I'm missing some simpler technique. Manuals and google gave me BUILD_REQUIRES option, but judging by manual of CPAN::FirstTime, it's rather an option for declaring a prerequisite as a possibly temporal module, so CPAN user can skip installing it if he wishes so.

Also, experimenting with such setup is not easy: I'll need to upload module A to the pause, then try to install it under CPAN, to see if my assumptions works.

So, simply speaking, I'm a bit out of tools when it comes to testing how my module behaves under CPAN environment. Are there any good advices? Thank you!

In reply to module needs another module for build by dk

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-10-04 19:06 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (18 votes). Check out past polls.