X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo%2FAtom.pm;h=8ee0f889d8789e2c4058fc9e37ee6aa5903b8c98;hp=a560326e6c19636cd43c7ef3b32e9663c307f7f4;hb=1501f44a9ccfe05c7525b70b7f1470bbb26453fd;hpb=2af17f47dcbf67aec8d360943f97b438c20d0429 diff --git a/lib/CPANPLUS/Dist/Gentoo/Atom.pm b/lib/CPANPLUS/Dist/Gentoo/Atom.pm index a560326..8ee0f88 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Atom.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Atom.pm @@ -75,6 +75,8 @@ BEGIN { eval "sub $_ { \$_[0]->{$_} }" for qw/category name version range ebuild/; } +sub qualified_name { join '/', $_[0]->category, $_[0]->name } + sub _spaceship { my ($a1, $a2, $r) = @_; @@ -97,7 +99,7 @@ sub _spaceship { sub _stringify { my ($a) = @_; - my $atom = $a->category . '/' . $a->name; + my $atom = $a->qualified_name; my $version = $a->version; $atom = $a->range . $atom . '-' . $version if defined $version; @@ -120,8 +122,8 @@ sub and { my $a2 = shift; $a2 = $a2->and(@_) if @_; - my $p1 = join '/', $a1->category, $a1->name; - my $p2 = join '/', $a2->category, $a2->name; + my $p1 = $a1->qualified_name; + my $p2 = $a2->qualified_name; Carp::confess("Atoms for different packages $p1 and $p2") unless $p1 eq $p2; my $v1 = $a1->version; @@ -160,7 +162,7 @@ sub fold { my %seen; for my $atom (@_) { - my $key = join '/', $atom->category, $atom->name; + my $key = $atom->qualified_name; my $cur = $seen{$key}; $seen{$key} = defined $cur ? $cur->and($atom) : $atom;