Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 30131
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

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



Subject: Check perl version before fetching distribution version from file
Given a Build.PL file which looks like this: use Module::Build; my $build = Module::Build->new ( module_name => 'Bar', license => 'perl', dist_version_from => 'lib/Bar.pm', requires => { 'perl' => '5.6.1', }, ); $build->create_build_script; __END__ lib/Bar.pm now contains a $VERSION specification use the post-5.005 "our" construct. Calling Build.PL with perl5.00505 will result in following error messages: Error evaling version line 'BEGIN { q# Hide from _packages_inside() #; package Module::Build::ModuleInfo::_version; no strict; local $VERSION; $VERSION=undef; $vsub = sub { our $VERSION = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/);; $VERSION }; }' in /tmp/Bar/lib/Bar.pm: Can't modify subroutine entry in scalar assignment at (eval 14) line 8, at EOF BEGIN not safe after errors--compilation aborted at (eval 14) line 11, <GEN6> chunk 18. failed to build version sub for /tmp/Bar/lib/Bar.pm at /usr/perl5.005_05/lib/site_perl/5.005/Module/Build/ModuleInfo.pm line 309, <GEN6> chunk 18. This is especially bad for automated testers like CPAN::Reporter, as there's no indication what went wrong. I think this problem could be solved if the perl requirement would be checked first. Regards, Slaven
From: SREZIC [...] cpan.org
On Fri Oct 19 17:49:49 2007, SREZIC wrote: [...] Show quoted text
> > I think this problem could be solved if the perl requirement would be > checked first. >
With the attached patch at least the perl requirement is now checked before getting the dist version. But I think that the die in Module::Build::ModuleInfo::_evaluate_version_line() should also be catched.
# # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -up '../build/Module-Build-0.2808-yt0HIq/lib/Module/Build/Base.pm' 'Module-Build-0.2808/lib/Module/Build/Base.pm' Index: ./lib/Module/Build/Base.pm --- ./lib/Module/Build/Base.pm Sat Apr 28 19:50:55 2007 +++ ./lib/Module/Build/Base.pm Sat Oct 20 10:03:47 2007 @@ -30,12 +30,12 @@ sub new { die "Too early to specify a build action '$self->{action}'. Do 'Build $self->{action}' instead.\n" if $self->{action} && $self->{action} ne 'Build_PL'; - $self->dist_name; - $self->dist_version; - $self->check_manifest; $self->check_prereq; $self->check_autofeatures; + + $self->dist_name; + $self->dist_version; $self->_set_install_paths; $self->_find_nested_builds; #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Sat Oct 20 10:17:57 2007 # Generated by : makepatch 2.03 # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 'lib/Module/Build/Base.pm' 119957 1192867427 0100444 #### End of ApplyPatch data #### #### End of Patch kit [created: Sat Oct 20 10:17:57 2007] #### #### Patch checksum: 54 1959 60185 #### #### Checksum: 72 2583 46186 ####
Sounds like a good idea. Patch applied, thanks. -Ken