Subject: | Can't use $] to select Perl version |
The %version hash is initialized with bare numbers for each Perl
version. Unfortunately, the tokenizer will have already eaten trailing
zeros before the fat comma operator is seen, hence the normal
stringification behavior won't have the appropriate affect.
This can be seen by doing something simple like:
perl5.10.0 -MModule::CoreList -e \
'print keys(%{$Module::CoreList::version{$]}})'
which will be empty, since $] is a string not a number. Using $]+0 (to
force numification) will display all of the modules released with 5.10.0.
Either 5.000 and 5.010000 need to be quoted in the %version
initialization or an alias be created, so either 5.01 or "5.010000" (and
hence $]) will work. This latter is probably better to use, trivial patch
--- lib/Module/CoreList.pm.orig 2008-12-19 11:15:24.000000000 -0500
+++ lib/Module/CoreList.pm 2008-12-19 11:18:14.000000000 -0500
@@ -8664,5 +8664,10 @@ for my $version ( sort { $a <=> $b } key
},
);
+# Create aliases with trailing zeros for $] use
+
+$version{'5.000'} = $version{5};
+$version{'5.010000'} = $version{5.01};
+
1;
__END__