I've been converting my Makefile.PL's to Build.PL's. One that I'm not sure how
to approach, though, is the one for RPC::XML.

In it, I create some suffix rules for the Makefile to use in converting method
data into XPL files (an expression of XML-RPC methods in XML that contains
signature information as well as the code). It requires executing an external
script, something it seems that Build tries really hard to avoid. Of course,
with a gmake-compatible controller (either gmake itself in disguise as make, or
dmake on MSWin systems) I didn't have to worry about that.

The relevant parts from my Makefile.PL are:

sub MY::post_initialize
{
    my $self = shift;

    my @text;
    my $makemeth = File::Spec->catfile(qw(etc make_method));

    push(@text,
         '.SUFFIXES: .xpl .base',
         '',
         '.base.xpl:',
         "\t\$(PERL) $makemeth --base=\$*",
         '');
    join("\n", @text);
}

sub MY::postamble
{
    my $self = shift;

    my @text;
    my $makemeth = File::Spec->catfile(qw(etc make_method));

    # Create the dependancy rules for the methods/XPL files
    for (sort grep(/\.xpl$/, keys %::PM_FILES))
    {
        s/\.xpl$//;
        push(@text, "$_.xpl: $_.base $_.help $_.code $makemeth");
    }

    join("\n", @text);
}

The first block creates a suffixes rule for turning *.base into *.xpl. The
second block creates dependency rules that tell make that X.xpl depends on
X.code, X.help, X.base and the "make_method" script.

What is the accepted "best practice" for doing stuff like this with M::B?

Randy
-- 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray      Westminster, CO    http://www.rjray.org   [EMAIL PROTECTED]

Silicon Valley Scale Modelers: http://www.svsm.org

Reply via email to