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

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.