From: John Peacock via RT Date: Sun, 18 Jan 2009 16:41:20 +0000 (+0100) Subject: Add aliases for several version numbers in Module::CoreList X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8f83a467c1f6205b90407eb8f0561d2e35738a77;p=p5sagit%2Fp5-mst-13.2.git Add aliases for several version numbers in Module::CoreList [rt.cpan.org #41827] 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 (rgs: I added aliases for the %released and %patchlevel hashes too.) --- diff --git a/lib/Module/CoreList.pm b/lib/Module/CoreList.pm index c68d81f..7b117f3 100644 --- a/lib/Module/CoreList.pm +++ b/lib/Module/CoreList.pm @@ -9076,5 +9076,16 @@ for my $version ( sort { $a <=> $b } keys %released ) { }, ); +# Create aliases with trailing zeros for $] use + +$released{'5.000'} = $released{5}; +$released{'5.010000'} = $released{5.01}; + +$patchlevel{'5.000'} = $patchlevel{5}; +$patchlevel{'5.010000'} = $patchlevel{5.01}; + +$version{'5.000'} = $version{5}; +$version{'5.010000'} = $version{5.01}; + 1; __END__