From: Vincent Pit Date: Sun, 29 Nov 2009 13:11:07 +0000 (+0100) Subject: Also infer the range when initializing a C::D::G::Atom object from an atom string X-Git-Tag: v0.09~5 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=eec0ec3915edc56c40c9ab85e50f22d2aee29beb Also infer the range when initializing a C::D::G::Atom object from an atom string --- diff --git a/lib/CPANPLUS/Dist/Gentoo/Atom.pm b/lib/CPANPLUS/Dist/Gentoo/Atom.pm index 5cd01e3..76af6fe 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Atom.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Atom.pm @@ -48,16 +48,16 @@ sub new { my %args = @_; - my ($category, $name, $version); + my ($range, $category, $name, $version); if (defined $args{name}) { - ($category, $name, $version) = @args{qw/category name version/}; + ($range, $category, $name, $version) = @args{qw/range category name version/}; Carp::confess('Category unspecified') unless defined $category; /[^\w-]/ and Carp::confess('Invalid argument') for $name, $category; } elsif (defined $args{atom}) { my $atom = $args{atom}; - $atom =~ m{^([\w-]+)/([\w-]+)-v?($version_rx)$} + $atom =~ m{^(<|<=|=|>=|>)?([\w-]+)/([\w-]+)(?-v?($version_rx))?$} or Carp::confess('Invalid atom'); - ($category, $name, $version) = ($1, $2, $3); + ($range, $category, $name, $version) = ($1, $2, $3, $4); } else { Carp::confess('Not enough information for building an atom object'); } @@ -69,7 +69,6 @@ sub new { } } - my $range = $args{range}; if (defined $version) { if (defined $range) { Carp::confess("Invalid range $range")