Re: [RESEND] Machine-Manipulatable Arguments for Module::Build

[email protected] (Shlomi Fish)
Newsgroups perl.module.build,perl.module-authors
Message-ID <[email protected]>
On Saturday 02 August 2008, David E. Wheeler wrote:
> On Aug 2, 2008, at 07:17, Shlomi Fish wrote:
> > http://xrl.us/bi6n9 (link to svn.berlios.de) is a functional spec
> > for a way to
> > tag and classify CPAN modules. Those tags and catgories should end
> > up in the
> > META.yml. However, inserting them by hand by editing the Build.PL
> > will be:
>
> You are aware of the keywords param to new(), right?
>
> =item keywords
>
> For describing the distribution using keyword (or "tags") in order to
> make CPAN.org indexing and search more efficient and useful.
>
> See L<http://module-build.sourceforge.net/META-spec-current.html#keywords
>

Hmmm... that's interesting. Sounds useful. Is it supported in 
search.cpan.org/kobesearch yet? Of course, I'd also like to have 
Freshmeat-like categories:

http://freshmeat.net/browse/18/

>  >.
> >
> > 1. Error-prone.
>
> Why is that?
>

Because "The only thing that can parse Perl is perl". It would be very hard to 
write a third-party program that will parse a typical Build.PL syntax and 
manipulate it along with all the possible edge-cases. For example, in some of 
my modules I have used a sub-class of Module::Build (which I called 
Test::Run::Builder) instead, so if I'm looking for Module::Build I won't find 
it.

Similarly, I can name the Module::Build instance in any way I want which will 
further complicate things. Or I can put some of the parameters in variables, 
etc.

> > 2. Not capabale of being manipulated by an external program - "Only
> > perl can
> > understand Perl, etc.".
>
> It looks like M::B does not current put the keywords into the META.yml
> file when you run `make distmeta`. It ought to. That's where you
> should start your patch, IMHO. Once the're in the META.yml, any YAML-
> compliant program can of course read them.

Yes, but if I over-ride the paramaters in META.yml, then it will be 
over-written once I re-run Build.PL. META.yml is entirely at the mercy of 
Build.PL and should not be edited by hand.

I want to allow a program or a human to give parameters to Build.PL so they'll 
eventually be preserved there.

>
> > Of course, this is not limited to this issue. I've overheard a
> > conversation on
> > a #perl where some people said they'd like to have all the (non-code)
> > parameters to Module::Build be speicified in a YAML format or so.
>
> Um, what for? Write a YAML file to be read by M::B to write out
> META.yml? Seems silly to me.

No, it's not. Build.PL places some other parameters into META.yml, like the 
individiuals .pm files and their versions, etc. We need a way to input it 
paraemeters in a way that's not hard-coded in the Build.PL Perl code.

>
> > So I've been thinking of having a special file or files for this (or
> > alternatively possibly re-use the __DATA__ section of the Build.PL)
> > in order
> > to specify machine-manipulatable parameters to the Build process.
>
> I find Perl easier to type than YAML. YAML is much more error-prone,
> IMO.

Yes, but computer programs can more easily read and write YAML.

>
> > Given enough willingness, I'm willing to volunteer the time to
> > implement it in
> > the current version of M::B (and possibly EU::MM and M::I). I
> > suppose it can
> > also be implemented as a user-land wrapper around Module::Build, but
> > would
> > like to get some input first.
>
> As a start, all of the keys specified in the META spec should be
> written to META.yml. Beyond that, well, just know that the Ant folks
> started out just using XML in their build files, but then needed
> processing, and so created a Turing-complete XML programming language.
> James Duncan Davidson has since told me that if he had to do it again,
> Ant build files would just have been written in Python or Ruby or
> something, rather than XML.
>
> So, let's not try to learn that lesson in reverse, eh?
>

Well, I'm not proposing that we completely do away with Build.PL or even with 
the parameters given to the Module::Build constructor. I'm just saying that 
we should give a way for programs to give it arguments as well, without 
having to parse the Perl and try to make sense of it.

So we have the machine+human-manipulatable input and the data and code in the 
Build.PL as input to Module::Build.

Regards,

	Shlomi Fish

-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/

I met a guy in the bar, talked to her and she gave me her phone number.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.