eval "sub $_ { \$_[0]->{$_} }" for qw/category name version range ebuild/;
}
+sub qualified_name { join '/', $_[0]->category, $_[0]->name }
+
sub _spaceship {
my ($a1, $a2, $r) = @_;
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;
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;
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;