Permalink
Browse files

scripts/dancer: Convert version to float

ExtUtils::MakeMaker usually has a $VERISON like '6.30_02', and
trying to numerical comparisons on that will yield something like

 Argument "6.30_02" isn't numeric in numeric ge (>=) at Makefile.PL line 5.

when trying to run the generated Makefile.PL.

This change does an ugly regexp, simply removing the underscore,
on the string prior to using it for comparison. I.e.:

 6.30_02 => 6.3002
  • Loading branch information...
1 parent 2c67575 commit 11710836692ea17db53abb23de6891c1cf8690a5 @olof olof committed with yanick Feb 8, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 script/dancer
View
@@ -323,12 +323,17 @@ sub templates($) {
use warnings;
use ExtUtils::MakeMaker;
+# Normalize version strings like 6.30_02 to 6.3002,
+# so that we can do numerical comparisons on it.
+my \$eumm_version = \$ExtUtils::MakeMaker::VERSION;
+\$eumm_version =~ s/_//;
+
WriteMakefile(
NAME => '$appname',
AUTHOR => q{YOUR NAME <youremail\@example.com>},
VERSION_FROM => 'lib/$appfile.pm',
ABSTRACT => 'YOUR APPLICATION ABSTRACT',
- (\$ExtUtils::MakeMaker::VERSION >= 6.3001
+ (\$eumm_version >= 6.3001
? ('LICENSE'=> 'perl')
: ()),
PL_FILES => {},

0 comments on commit 1171083

Please sign in to comment.