-----BEGIN PGP SIGNED MESSAGE-----

Moin,

On Saturday 20 November 2004 23:07, Randy W. Sims wrote:
> Tels wrote:
> > I already wondered many times why the license for most of my modules is
> > not set/shown at search.cpan.org, even though modules like BigInt have
> > simple the perl license (being part of the core etc).
> >
> > Seems like setting a "license: perl" line in META.yml would fix this.
> > However, everytime I run "make dist", the META.yml file is overwritten
> > again, with the license line missing. And it seems that MakeMaker doesn't
> > have a "LICENSE =>" setting.
> >
> > Of course, I can set "NO_META" to true, and modify the META.yml file
> > manually, but that looses the handy property that META.yml is
> > autogenerated with the correct dependencies etc. (e.g. everytime I change
> > Makefile.PL, I have to remember to change META.yml, which I surely will
> > forget from time to time. Ugh.)
> >
> > So, is it possible to have MakeMaker to generate the license line
> > automagically, or I am something missing?
>
> Current versions of MM don't have an option for setting the license. I
> think I sent a patch a while back for the next release. You can find an
> example of how you can override MM's rule for creating META.yml in:
> <http://search.cpan.org/src/MHX/Convert-Binary-C-0.56/Makefile.PL>
>
> Search for 'sub MY::metafile'
>
> Randy.
>
>
> PS: If you do override the generation of the meta file, it's a good idea
> to follow Marcus' convention for setting 'generated_by' =>
> 'Your::Module::Name Makefile.PL'. Or if you create it by hand (NO_META),
> then set 'generated_by' => 'Author Name, by hand'. These conventions
> make it easy to see who's doing what with META.yml.

Thanx for the pointers. The MY::metafile routine in Convert-Binary does have a 
few problems, though:

* if YAML is not installed, it would silenty drop the generation and fallback
* the generated_by header did simple contain " Makefile.PL"
* a few entries (most importantly requires) were missing 

I include a fixed version which I used for Set::String.

best wishes,

Tels

sub MY::metafile {
  package MY;
  my $self = shift;
  if (!eval { require YAML; 1 })
  {
    warn ("YAML not installed, cannot override metafile"); return 
$self->SUPER::metafile_target(@_);
  };

  my $node = new YAML::Node {};

  $node->{name}                 = $self->{DISTNAME};
  $node->{version}              = $self->{VERSION};
  $node->{version_from}         = $self->{VERSION_FROM};
  $node->{license}              = 'perl';
  $node->{distribution_type}    = 'module';
  $node->{generated_by}         = "$self->{DISTNAME} version 
$self->{VERSION}";
  $node->{installdirs}          = 'site';
  $node->{requires}             = $self->{PREREQ_PM};

  my $dump = YAML::Dump( $node );

  $dump =~ s/^(.*)$/\t\$(NOECHO) \$(ECHO) "$1" >>META.yml/gm;
  $dump =~ s/>>META\.yml/>META.yml/;

  return "metafile:\n$dump";
}

- -- 
 Signed on Fri Nov 26 19:44:48 2004 with key 0x93B84C15.
 Visit my photo gallery at http://bloodgate.com/photos/
 PGP key on http://bloodgate.com/tels.asc or per email.

 "...no one would risk manipulating votes in an election because it's
 against the law and carries a heavy penalty..." -- Diebold spokesman David
 Bear

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iQEVAwUBQad6o3cLPEOTuEwVAQH1OQf6Ah3LJXIrX31kLgGCrLzh0q+wf687wxAV
+iVMQo5BsoOB1GoeeOO5Bi9fTtO3E8dm1YheUJyBe8UmYnD4VnHy3tM24Jv26jLK
sN20TEDUwPffQclx6+TfRr+BP/CWaO5ibBe54jvq++5llgSW3oE9JNQCDP0wHCDt
ZLt5J6HnKByOUty41n5OrZQDs7LrLz0LjxykE1GqvYp/GMKM9NLMuuN7gZ2UXXLV
o8s2TWcW9nNp2Vwo0LESp86QvmYSP9I6uqkJrRchi5YqoAKTGBYifotWw+T4mJXI
V3vVQMnTyvnHTdpOUG7nZ6CUKDUXEJk0xWGZY+IrFNctWdU0lAPahg==
=9Gbd
-----END PGP SIGNATURE-----

Reply via email to