Subject: | work around for PROVIDE needed |
Date: | Wed, 9 Jul 2014 14:57:55 +0000 |
To: | "bug-PPM-Make [...] rt.cpan.org" <bug-PPM-Make [...] rt.cpan.org> |
From: | "Neubauer, Ralf" <ralf.neubauer [...] wido.bv.aok.de> |
Hi,
the generated PPDs have not PROVIDE entries. This may be caused by Bug #97053, but as I don't know how to fix Bug #97053, I needed a work around to make ppm usable (installing a module by asking for a package).
My pragmatic solution is:
--- PPM\Make.pm.orig 2012-02-02 14:15:37.000000000 +0100
+++ PPM\Make.pm 2014-07-09 16:22:08.865734500 +0200
@@ -629,6 +629,20 @@
sub print_ppd {
my ($self, $d, $fn) = @_;
+ if (-s 'MANIFEST' && !@{$d->{PROVIDE} || []}) {
+ use File::Slurp;
+ for my $pm (map /^lib[\\\/](.*?)\.pm(?:\s.*)?$/ ? ($1) : (),
+ read_file 'MANIFEST', chomp => 1) {
+ $pm =~ s/[\\\/]/::/g or $pm .= '::';
+ push @{$d->{PROVIDE}}, {NAME => $pm};
+ }
+ }
+ if (!@{$d->{PROVIDE} || []}) {
+ my $pm = $d->{TITLE};
+ $pm =~ s/-[\d\.]*$//;
+ $pm =~ s/-/::/g or $pm .= '::';
+ push @{$d->{PROVIDE}}, {NAME => $pm};
+ }
open (my $fh, '>', $fn) or die "Couldn't write to $fn: $!";
my $title = xml_encode($d->{TITLE});
my $abstract = xml_encode($d->{ABSTRACT});
This may not be an elegant solution (and I wouldn't mind a better one), but it works for me. Of course you may not want to use File::Slurp -- I installed it anyway, so I use it.
Ralf