On Fri, Dec 10, 2010 at 7:40 PM, David Christensen
<dpchr...@holgerdanske.com> wrote:
> Does 'configure_requires' support map to a Perl version?

It really maps to CPAN client versions, but Perl 5.10.1 ships with
CPAN and CPANPLUS that understand configure_requires.  Older Perls
only need to upgrade CPAN and/or CPANPLUS to support it.

> STFW, it looks like BUILD_REQUIRES and CONFIGURE_REQUIRES are supported as
> of Perl 5.10.1:
>
>    http://perldoc.perl.org/5.10.1/ExtUtils/MakeMaker.html

*You* need an ExtUtils::MakeMaker that supports them in order to
create your distribution.  Your end users do not.  However, for users
with older EU::MM, you need to not pass those keys to WriteMakefile()
and you need to add the BUILD_REQUIRES to PREREQ_PM instead.

This sort of complicated Makefile.PL manipulation is why many people
have switched to Module::Install or Dist::Zilla instead as they take
care of those details for you.

> Thanks -- I read that recently.  But I missed the citation to "Writing Perl
> Modules for CPAN":
>
>    http://www.amazon.com/dp/159059018X/ref=cm_sw_su_dp
>
> Should I get this book, or is there a newer/ better resource?

It was a great book but is now very, very out of date.  The tutorials
on PerlMonks are probably better:

http://perlmonks.org/index.pl?node_id=592240

>    make all:
>        -- run pod2text against main module and put that into README.
>        -- run pod2html against listed files and put that into HTML
>           files.
>
>    make mcpani
>        -- run mcpani and inject tarball into my CPAN Mini Mirror
>
>    make release
>        -- copy tarball and *.html files to file server
>
> If I wanted to migrate this functionality to a newer tool, how well suited
> would Module::Install, Module::Builder, and Dist::Zilla be?

Personally, as I suggested in my article, I would probably use
Module::Build for customizations like that.  (Though there are
probably Dist::Zilla plugins for a lot of it, too.)

Module::Build already can create the README for you with the
"create_readme" parameter.  If you have HTML install paths in Config
(or define them yourself in the Build.PL or on the command line) and
have Pod::HTML installed, Module::Build will generate the HTML for you
automatically.

For the rest, it's trivially easy to subclass.   You would just need
to create a subclass module, drop it into an "inc/" and do this in
Build.PL (e.g. for inc/MyBuilder.pm):

    use lib 'inc';
    use MyBuilder;
    MyBuilder->new( ... )->create_build_script;

In MyBuilder.pm, you'd have things like:

    use Module::Build;
    our @ISA = qw/Module::Build/;

    sub ACTION_mcpani { ... }
    sub ACTION_release { ... }

See Module::Build::Cookbook for examples.  You can also see the
Build.PL and inc/ subclass example here:
http://search.cpan.org/~dagolden/ylib-0.002/MANIFEST

The Module::Build distribution itself uses a Build subclass that
includes code to ship M::B ("Build upload") and is a good example of
what is possible.  You'll see in the "ACTION_distdir" in the subclass
that it autogenerates some Pod and then
writes itself out of the Build.PL that ships so end users never even
see the subclass.  Tricky!

https://github.com/dagolden/module-build/blob/master/inc/ModuleBuildBuilder.pm

Hope those help.  Regards,
David

Reply via email to