From: Vincent Pit Date: Sun, 29 Nov 2009 00:20:54 +0000 (+0100) Subject: Make overload methods private X-Git-Tag: v0.09~13 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=2af17f47dcbf67aec8d360943f97b438c20d0429;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Make overload methods private --- diff --git a/lib/CPANPLUS/Dist/Gentoo/Atom.pm b/lib/CPANPLUS/Dist/Gentoo/Atom.pm index bc0e9c0..a560326 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Atom.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Atom.pm @@ -9,8 +9,8 @@ use Carp (); use Scalar::Util (); use overload ( - '<=>' => \&cmp, - '""' => \&as_string, + '<=>' => \&_spaceship, + '""' => \&_stringify, ); use CPANPLUS::Dist::Gentoo::Version; @@ -75,7 +75,7 @@ BEGIN { eval "sub $_ { \$_[0]->{$_} }" for qw/category name version range ebuild/; } -sub cmp { +sub _spaceship { my ($a1, $a2, $r) = @_; my $v1 = $a1->version; @@ -94,7 +94,7 @@ sub cmp { return $v1 <=> $v2; } -sub as_string { +sub _stringify { my ($a) = @_; my $atom = $a->category . '/' . $a->name; diff --git a/lib/CPANPLUS/Dist/Gentoo/Version.pm b/lib/CPANPLUS/Dist/Gentoo/Version.pm index bdfd755..1214582 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Version.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Version.pm @@ -6,8 +6,8 @@ use warnings; use Scalar::Util (); use overload ( - '<=>' => \&cmp, - '""' => \&as_string, + '<=>' => \&_spaceship, + '""' => \&_stringify, ); our $VERSION = '0.08'; @@ -45,7 +45,7 @@ BEGIN { eval "sub $_ { \$_[0]->{$_} }" for @parts; } -sub cmp { +sub _spaceship { my ($v1, $v2, $r) = @_; unless (Scalar::Util::blessed($v2) and $v2->isa(__PACKAGE__)) { @@ -68,7 +68,7 @@ sub cmp { return 0; } -sub as_string { +sub _stringify { my ($v) = @_; my ($version, $patch, $revision) = map $v->$_, @parts;