From 77e3eb9e7b18be9228d1c7c7f2430fd01e58d99a Mon Sep 17 00:00:00 2001 From: Justin Davis Date: Tue, 3 Jul 2012 19:55:06 -0400 Subject: Strip zeros from dependencies upon the perl package. --- preps/perl.d/perl-dist | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'preps') diff --git a/preps/perl.d/perl-dist b/preps/perl.d/perl-dist index 748ce11..c6fa2e3 100755 --- a/preps/perl.d/perl-dist +++ b/preps/perl.d/perl-dist @@ -171,12 +171,11 @@ sub _perldepver # Fix perl-style vstrings which have a leading "v". return $perlver if($perlver =~ s/\Av//); - return $perlver unless($perlver =~ /\A(\d+)[.](\d{3})(\d{1,3})\z/); - # Re-apply the missing trailing zeroes. - my $patch = $3; - $patch .= q{0} x (3 - length $patch); - return sprintf('%d.%d.%d', $1, $2, $patch); + my @v; + return $perlver unless(@v = $perlver =~ /\A(\d+)[.](\d{1,3})(\d{0,3})\z/); + pop @v unless($v[2]); + return join q{.}, map { int } @v; # int removes zeroes } #---PUBLIC FUNCNTION--- -- cgit v1.2.3-24-g4f1b