From: Vincent Pit Date: Fri, 27 Nov 2009 16:13:09 +0000 (+0100) Subject: Infer the right category and name when creating an atom from an ebuild or a string X-Git-Tag: v0.09~17 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=9c0162fc729f9b0cc7bff16ef1c4aa07cf9c2ab9 Infer the right category and name when creating an atom from an ebuild or a string --- diff --git a/lib/CPANPLUS/Dist/Gentoo/Atom.pm b/lib/CPANPLUS/Dist/Gentoo/Atom.pm index bd0febd..ebe6a4e 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Atom.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Atom.pm @@ -23,21 +23,21 @@ sub new { my %args = @_; - my ($name, $category, $version); + my ($category, $name, $version); if (defined $args{name}) { - ($name, $category, $version) = @args{qw/name category version/}; + ($category, $name, $version) = @args{qw/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)$} or Carp::confess('Invalid atom'); - ($name, $category, $version) = ($1, $2, $3); + ($category, $name, $version) = ($1, $2, $3); } elsif (defined $args{ebuild}) { my $ebuild = $args{ebuild}; - $ebuild =~ m{/([\w-]+)/([\w-]+)-v?($version_rx)\.ebuild$} + $ebuild =~ m{/([\w-]+)/([\w-]+)/\2-v?($version_rx)\.ebuild$} or Carp::confess('Invalid ebuild'); - ($name, $category, $version) = ($1, $2, $3); + ($category, $name, $version) = ($1, $2, $3); } else { Carp::confess('Not enough information for building an atom object'); }