[PATCH] Print CONFIGURE params in ExtUtils::MakeMaker output
by David D. Kilzer other posts by this author
Jul 23 2001 4:32PM messages near this date
Re: [ID 20010721.003] Perl's configure script should be able to use
Config.pm for its defaults
|
perl5-porters meeting tonight
Below is a patch for ExtUtils::MakeMaker.pm (against v5.45) that will
print out any parameters returned from a 'CONFIGURE' directive in the
'Makefile' that is generated. I found this useful when using the
'CONFIGURE' directive in a Makefile.PL for Bugzilla (still working on
it).
Hope you find it useful!
Dave
--
David D. Kilzer
Senior Systems & Software Engineer
Competetive Solutions, Inc.
ddkilzer@[...].com
diff -u ExtUtils/MakeMaker.pm.orig ExtUtils/MakeMaker.pm
--- ExtUtils/MakeMaker.pm.orig Mon Feb 26 09:39:36 2001
+++ ExtUtils/MakeMaker.pm Mon Jul 23 11:20:26 2001
@@ -326,7 +326,8 @@
check_hints($self);
- my(%initial_att) = %$self; # record initial attributes
+ my %configure_att; # record &{$self-> {CONFIGURE}} attributes
+ my(%initial_att) = %$self; # record initial attributes
my($prereq);
foreach $prereq (sort keys %{$self-> {PREREQ_PM}}) {
@@ -365,7 +366,8 @@
if (defined $self-> {CONFIGURE}) {
if (ref $self-> {CONFIGURE} eq 'CODE') {
- $self = { %$self, %{&{$self-> {CONFIGURE}}}};
+ %configure_att = %{&{$self-> {CONFIGURE}}};
+ $self = { %$self, %configure_att };
} else {
Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
}
@@ -470,6 +472,27 @@
$v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
$v =~ tr/\n/ /s;
push @{$self-> {RESULT}}, "# $key => $v";
+ }
+ undef %initial_att; # free memory
+
+ if (defined $self-> {CONFIGURE}) {
+ push @{$self-> {RESULT}}, <<END;
+
+# MakeMaker 'CONFIGURE' Parameters:
+END
+ if (scalar(keys %configure_att) > 0) {
+ foreach $key (sort keys %configure_att){
+ my($v) = neatvalue($configure_att{$key});
+ $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
+ $v =~ tr/\n/ /s;
+ push @{$self-> {RESULT}}, "# $key => $v";
+ }
+ }
+ else
+ {
+ push @{$self-> {RESULT}}, "# no values returned";
+ }
+ undef %configure_att; # free memory
}
# turn the SKIP array into a SKIPHASH hash
|