Skip Menu |

This queue is for tickets about the Test-YAML-Meta CPAN distribution.

Report information
The Basics
Id: 43566
Status: resolved
Priority: 0/
Queue: Test-YAML-Meta

People
Owner: Nobody in particular
Requestors: dagolden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: v-strings should be a valid version
PAUSE, search.cpan.org and the toolchain (CPAN, etc.) can handle "v1.2.3" as a version string. M::B even generates it for version.pm versions. The attached patch adds supports (and tests).
Subject: 0001-allow-v1.2.3-as-a-valid-version-string.patch
From 75b8abe69e2ee26b989a358e36e417fd88d1633e Mon Sep 17 00:00:00 2001 From: David Golden <dagolden@cpan.org> Date: Mon, 23 Feb 2009 07:34:45 -0500 Subject: [PATCH] allow v1.2.3 as a valid version string --- lib/Test/YAML/Meta/Version.pm | 4 ++-- t/03metaversion.t | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Test/YAML/Meta/Version.pm b/lib/Test/YAML/Meta/Version.pm index 8973525..3694d37 100644 --- a/lib/Test/YAML/Meta/Version.pm +++ b/lib/Test/YAML/Meta/Version.pm @@ -503,7 +503,7 @@ Validates a list of versions, e.g. '<= 5, >=2, ==3, !=4, >1, <6, 0'. =item * version($self,$key,$value) Validates a single version string. Versions of the type '5.8.8' and '0.00_00' -are both valid. +are both valid. A leading 'v' like 'v1.2.3' is also valid. =item * boolean($self,$key,$value) @@ -629,7 +629,7 @@ sub version { my ($self,$key,$value) = @_; if(defined $value) { return 0 unless($value || $value =~ /0/); - return 1 if($value =~ /^\s*((<|<=|>=|>|!=|==)\s*)?\d+((\.\d+((_|\.)\d+)?)?)/); + return 1 if($value =~ /^\s*((<|<=|>=|>|!=|==)\s*)?v?\d+((\.\d+((_|\.)\d+)?)?)/); } else { $value = '<undef>'; } diff --git a/t/03metaversion.t b/t/03metaversion.t index a60e768..4415f7e 100644 --- a/t/03metaversion.t +++ b/t/03metaversion.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 86; +use Test::More tests => 88; use Test::YAML::Meta::Version; my $spec = Test::YAML::Meta::Version->new(spec => '1.3'); @@ -49,6 +49,8 @@ is($spec->exversion('exversion'),0); is($spec->version('version','0'),1,'valid basic version'); is($spec->version('version','0.00'),1); is($spec->version('version','0.00_00'),1); +is($spec->version('version','0.0.0'),1); +is($spec->version('version','v0.0.0'),1); is($spec->version('version','<6'),1); is($spec->version('version','!4'),0); is($spec->version('version',''),0); -- 1.5.6.3
Fixed in Test-YAML-Meta-0.12, and also ported to Test-CPAN-Meta-0.13. Many apologies for the delay in getting this fixed :(