Author: dagolden
Date: Tue Mar 3 20:25:42 2009
New Revision: 12568
Modified:
Module-Build/trunk/ (props changed)
Module-Build/trunk/Changes
Module-Build/trunk/lib/Module/Build/Compat.pm
Module-Build/trunk/t/compat.t
Log:
Module::Build::Compat had stopped adding PL_FILES=>{} if PL_files wasn't set in
Build.PL; restored old behavior. Also fixed buggy tests that weren't detecting
this bug and changed ancient documentation suggesting setting PL_FILES manually
as that is irrelevant now that this works again.
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Tue Mar 3 20:25:42 2009
@@ -2,6 +2,11 @@
0.32_01 -
+ Bug-fixes:
+ - Module::Build::Compat had stopped adding "PL_FILES => {}" when no
+ PL_files property was set in Build.PL; restored old behavior and fixed
+ tests and documentation related to this issue [David Golden]
+
0.32 - Wed Feb 25 17:40:02 PST 2009
No changes since 0.31_04.
Modified: Module-Build/trunk/lib/Module/Build/Compat.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Compat.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Compat.pm Tue Mar 3 20:25:42 2009
@@ -176,7 +176,7 @@
$MM_Args{EXE_FILES} = [ sort keys %{$build->script_files} ] if
$build->script_files;
- $MM_Args{PL_FILES} = $build->PL_files if $build->PL_files;
+ $MM_Args{PL_FILES} = $build->PL_files || {};
local $Data::Dumper::Terse = 1;
my $args = Data::Dumper::Dumper(\%MM_Args);
@@ -501,11 +501,7 @@
they won't get to take advantage of Module::Build's extra features
either.
-If you go this route, make sure you explicitly set C<PL_FILES> in the
-call to C<WriteMakefile()> (probably to an empty hash reference), or
-else MakeMaker will mistakenly run the Build.PL and you'll get an
-error message about "Too early to run Build script" or something. For
-good measure, of course, test both the F<Makefile.PL> and the
+For good measure, of course, test both the F<Makefile.PL> and the
F<Build.PL> before shipping.
=item 3.
Modified: Module-Build/trunk/t/compat.t
==============================================================================
--- Module-Build/trunk/t/compat.t (original)
+++ Module-Build/trunk/t/compat.t Tue Mar 3 20:25:42 2009
@@ -369,17 +369,17 @@
my $expected = shift;
SKIP: {
- skip "$makefile not found", 1 unless -e $makefile;
- my $pl_files = find_params_in_makefile()->{PL_FILES} || {};
- is_deeply $pl_files, $expected,
- "$makefile has correct PL_FILES line";
+ skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
+ my $args = extract_writemakefile_args() || {};
+ is_deeply $args->{PL_FILES}, $expected,
+ "Makefile.PL has correct PL_FILES line";
}
}
sub test_makefile_pl_requires_perl {
my $perl_version = shift || q{};
SKIP: {
- skip 'Makefile.PL not found', 1 unless -e 'Makefile.PL';
+ skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
my $file_contents = slurp 'Makefile.PL';
my $found_requires = $file_contents =~ m{^require $perl_version;}ms;
if (length $perl_version) {
@@ -417,3 +417,16 @@
return \%params;
}
+
+sub extract_writemakefile_args {
+ SKIP: {
+ skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
+ my $file_contents = slurp 'Makefile.PL';
+ my ($args) = $file_contents =~ m{^WriteMakefile\n\((.*)\).*;}ms;
+ ok $args, "Found WriteMakefile arguments"
+ or diag "Makefile.PL:\n$file_contents";
+ my %args = eval $args or diag $args; ## no critic
+ return \%args;
+ }
+}
+