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