diff options
author | Karl Williamson <khw@cpan.org> | 2019-10-26 18:51:29 -0600 |
---|---|---|
committer | Nicolas R <atoomic@cpan.org> | 2019-11-08 12:01:13 -0700 |
commit | a58fcf6069c7099e7f54af6167ccd3aebcff617f (patch) | |
tree | 8a82f60906b0ed91efdc98d787711783c97cf530 /dist/Devel-PPPort | |
parent | 815670afd6c2e4d76680eb75fb5e3199c8448cea (diff) | |
download | perl-a58fcf6069c7099e7f54af6167ccd3aebcff617f.tar.gz |
parts/inc/inctools: ivers(): Add version string inputs
(cherry picked from commit bb54da9a565f7fcf13708a69ed6a33a36bb32745)
Signed-off-by: Nicolas R <atoomic@cpan.org>
Diffstat (limited to 'dist/Devel-PPPort')
-rw-r--r-- | dist/Devel-PPPort/parts/inc/inctools | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/dist/Devel-PPPort/parts/inc/inctools b/dist/Devel-PPPort/parts/inc/inctools index 51648260cb..ba181fa6e7 100644 --- a/dist/Devel-PPPort/parts/inc/inctools +++ b/dist/Devel-PPPort/parts/inc/inctools @@ -20,8 +20,8 @@ sub format_version sub parse_version { - # Returns a triplet, (5, major, minor) from the input, which can be in any - # of several typical formats + # Returns a triplet, (5, major, minor) from the input, treated as a string, + # which can be in any of several typical formats. my $ver = shift; $ver = "" unless defined $ver; @@ -46,6 +46,19 @@ sub parse_version return (5, 0 + $v, 0 + $s); } + # For some safety, don't assume something is a version number if it has a + # literal dot as one of the three characters. This will have to be fixed + # when we reach 5.46 + if ($ver !~ /\./ && (($r, $v, $s) = $ver =~ /^(.)(.)(.)$/)) # vstring 5.25.7 + { + $r = ord $r; + $v = ord $v; + $s = ord $s; + + die "Only Perl 5 is supported '$ver'\n" if $r != 5; + return (5, $v, $s); + } + my $mesg = ""; $mesg = ". (In 5.00x_yz, x must be 1-5.)" if $ver =~ /_/; die "Invalid version number format: '$ver'$mesg\n"; |