use Scalar::Util ();
use overload (
- '<=>' => \&cmp,
- '""' => \&as_string,
+ '<=>' => \&_spaceship,
+ '""' => \&_stringify,
);
use CPANPLUS::Dist::Gentoo::Version;
eval "sub $_ { \$_[0]->{$_} }" for qw/category name version range ebuild/;
}
-sub cmp {
+sub _spaceship {
my ($a1, $a2, $r) = @_;
my $v1 = $a1->version;
return $v1 <=> $v2;
}
-sub as_string {
+sub _stringify {
my ($a) = @_;
my $atom = $a->category . '/' . $a->name;
use Scalar::Util ();
use overload (
- '<=>' => \&cmp,
- '""' => \&as_string,
+ '<=>' => \&_spaceship,
+ '""' => \&_stringify,
);
our $VERSION = '0.08';
eval "sub $_ { \$_[0]->{$_} }" for @parts;
}
-sub cmp {
+sub _spaceship {
my ($v1, $v2, $r) = @_;
unless (Scalar::Util::blessed($v2) and $v2->isa(__PACKAGE__)) {
return 0;
}
-sub as_string {
+sub _stringify {
my ($v) = @_;
my ($version, $patch, $revision) = map $v->$_, @parts;