--- cpan2rpm 2008-04-16 11:31:28.000000000 -0400
+++ cpan2rpm 2008-04-16 11:32:31.000000000 -0400
@@ -29,6 +29,7 @@
use Getopt::Long;
use Sys::Hostname;
use Pod::Text;
+use YAML;
my ($ME, $RPM, $TMPDIR, %RPMDIR, $CWD, %info, %meta, $ARGS);
@@ -389,12 +390,15 @@
chdir $info->{evaldir} || die "get_meta(): $!";
+ my $METAYML = "$info->{evaldir}/META.yml";
+ $METAYML = undef unless -e $METAYML;
$_ = "$info->{evaldir}/Build.PL";
$_ = "$info->{evaldir}/Makefile.PL" unless -e;
die qq/No PL file [$_] in tarball/ unless -e;
die qq/Cannot read PL file [$_]/ unless -r;
($info->{PL} = $_) =~ s|.*/||;
+
# we want to protect us from exit()ing but without modifying the
# actual Makefile.PL since we may be operating in a source directory
@@ -456,7 +460,20 @@
# map Build.PL hash keys to MakeMaker's
- if ($info->{PL} =~ /^Build/) {
+ if (defined($METAYML)) {
+ print "Using bundled META.yml for meta info ...", "\n";
+ my ($yml) = YAML::LoadFile($METAYML);
+ my %y2m = qw/
+ requires PREREQ_PM
+ name NAME
+ author AUTHOR
+ version VERSION
+ dist_version_from VERSION_FROM
+ /;
+ $meta{$y2m{$_}} = $yml->{$_} for keys %y2m;
+ $meta{NAME} =~ s/-/::/g;
+ }
+ elsif ($info->{PL} =~ /^Build/) {
my %b2m = qw/
requires PREREQ_PM
module_name NAME
@@ -475,6 +492,9 @@
for (keys %$deps) {
my $use = "use $_";
$use .= " $deps->{$_}" if $deps->{$_};
+ if ($_ eq 'perl') {
+ $use = "use $deps->{$_}";
+ }
local $^W = 0;
$@ = ""; eval $use;