From ce17cee89e086572d74e4b72eb6e599562a95598 Mon Sep 17 00:00:00 2001 From: "H.Merijn Brand" Date: Sun, 5 Apr 2009 16:46:20 +0200 Subject: [PATCH] reconstruct version from perl-v output (dagolden) --- Changelog | 4 ++++ V.pm | 6 +++++- t/20_plv.t | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 7048970..88da166 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +0.03 - 05 Apr 2009, H.Merijn Brand + + - Reconstruct version from perl-v output (dagolden) + 0.02 - 30 Mar 2009, H.Merijn Brand - Added plv2hash () diff --git a/V.pm b/V.pm index 51f74dd..7ae35d0 100644 --- a/V.pm +++ b/V.pm @@ -5,7 +5,7 @@ package Config::Perl::V; use strict; use warnings; -our $VERSION = "0.02"; +our $VERSION = "0.03"; use Config; @@ -190,6 +190,10 @@ sub plv2hash my $rev = $2; $rev =~ s/^ revision \s+ (\S+) \s*//x and $config{revision} = $1; $rev and $config{version_patchlevel_string} = $rev; + my ($rel) = $config{package} =~ m{perl(\d)}; + my ($vers, $subvers) = $rev =~ m{version\s+(\d+)\s+subversion\s+(\d+)}; + defined $vers && defined $subvers && defined $rel and + $config{version} = "$rel.$vers.$subvers"; next; } diff --git a/t/20_plv.t b/t/20_plv.t index be54928..1adf3ec 100644 --- a/t/20_plv.t +++ b/t/20_plv.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 9; use Test::NoWarnings; use Config::Perl::V; @@ -14,6 +14,7 @@ for (qw( build environment config inc )) { } is ($conf->{build}{osname}, $conf->{config}{osname}, "osname"); is ($conf->{build}{stamp}, 0, "No build time known"); +is ($conf->{config}{version}, "5.10.0", "reconstructed \%Config{version}"); __END__ Summary of my perl5 (revision 5 version 10 subversion 0) configuration: -- 2.11.4.GIT