Skip Menu |

This queue is for tickets about the Test-Distribution CPAN distribution.

Report information
The Basics
Id: 3194
Status: new
Priority: 0/
Queue: Test-Distribution

People
Owner: Nobody in particular
Requestors: trevor.schellhorn-perl [...] marketingtips.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.05
Fixed in: (no value)



Subject: Prereqs are not found when Makefile.PL contains __END__ tag or use line has characters after module name
In using the module in conjunction with Makefile.PL using Apache::test, I have run into a problem. The Makefile.PL has an __END__ tag and data after that for the httpd.conf file. When the prereq routine from Test::Distribution is run, it removes the use line for ExtUtils::MakeMaker and adds in a subroutine to capture the PREREQ_PM's from the Makefile.PL. Unfortunately, this new subroutine was added at the end of the modified Makefile.PL and never found. Also, when the prereq routine tries to remove the 'use ExtUtils::MakeMaker' line, it fails when there are other characters after it. An example of this is: use ExtUtils::MakeMaker qw(WriteMakefile); The search and replace would not find the line and remove it because it failed on the regular expression that searchs for it. Please contact me if you need any further information on this. Trevor
--- lib/Test/Distribution.pm.orig 2003-08-07 15:59:59.000000000 -0700 +++ lib/Test/Distribution.pm 2003-08-08 16:20:12.000000000 -0700 @@ -248,10 +248,19 @@ open my $fh, 'Makefile.PL' or die "can't open Makefile.PL: $!\n"; my $make = do { local $/; <$fh> }; close $fh or die "can't close Makefile.PL: $!\n"; - $make =~ s/use \s+ ExtUtils::MakeMaker \s* ;/no strict;/gx; + $make =~ s/use \s+ ExtUtils::MakeMaker \s* [^;]* ;/no strict;/gx; - $make .= 'sub WriteMakefile { - my %h = @_; our @prereq = keys %{ $h{PREREQ_PM} || {} } }'; + # Check to see if an '__END__' tag is used. If so, insert the + # modified WriteMakefile there + if( $make =~ m/__END__/ ) { + my $new_sub = 'sub WriteMakefile { + my %h = @_; our @prereq = keys %{ $h{PREREQ_PM} || {} } }'; + $make =~ s/(__END__)/$new_sub\n$1/; + } + else { + $make .= 'sub WriteMakefile { + my %h = @_; our @prereq = keys %{ $h{PREREQ_PM} || {} } }'; + } eval $make; die $@ if $@;