From: Vincent Pit Date: Sun, 29 Nov 2009 01:11:58 +0000 (+0100) Subject: Document C::D::G::{Atom,Version} X-Git-Tag: v0.09~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=93eb049958520c8b4980d76e5654e5cdd3774d2f;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Document C::D::G::{Atom,Version} --- diff --git a/lib/CPANPLUS/Dist/Gentoo/Atom.pm b/lib/CPANPLUS/Dist/Gentoo/Atom.pm index 543693e..e285b0c 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Atom.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Atom.pm @@ -3,8 +3,24 @@ package CPANPLUS::Dist::Gentoo::Atom; use strict; use warnings; +=head1 NAME + +CPANPLUS::Dist::Gentoo::Version - Gentoo atom object. + +=head1 VERSION + +Version 0.08 + +=cut + our $VERSION = '0.08'; +=head1 DESCRIPTION + +This class models Gentoo atoms. + +=cut + use Carp (); use Scalar::Util (); @@ -18,6 +34,14 @@ use CPANPLUS::Dist::Gentoo::Version; my $version_rx = $CPANPLUS::Dist::Gentoo::Version::version_rx; +=head1 METHODS + +=head2 C<< new category => $category, name => $name [, version => $version, range => $range, ebuild => $ebuild ] >> + +Creates a new L object from the supplied C<$category>, C<$name>, C<$version>, C<$range> and C<$ebuild>. + +=cut + sub new { my $class = shift; $class = ref($class) || $class; @@ -67,6 +91,12 @@ sub new { }, $class; } +=head2 C + +Creates a new L object by inferring the category, name and version from the given C<$ebuild> + +=cut + sub new_from_ebuild { my $class = shift; $class = ref($class) || $class; @@ -90,6 +120,32 @@ BEGIN { eval "sub $_ { \$_[0]->{$_} }" for qw/category name version range ebuild/; } +=head2 C + +Read-only accessor to the atom category. + +=head2 C + +Read-only accessor to the atom name. + +=head2 C + +Read-only accessor to the L object associated with the atom. + +=head2 C + +Read-only accessor to the atom range. + +=head2 C + +Read-only accessor to the path of an optional ebuild associated with the atom. + +=head2 C + +Returns the qualified name for the atom, i.e. C<$category/$name>. + +=cut + sub qualified_name { join '/', $_[0]->category, $_[0]->name } sub _spaceship { @@ -149,6 +205,12 @@ my %order = ( '>' => 2, ); +=head2 C + +Compute the ranged atom representing the logical AND between C<@atoms> with the same category and name. + +=cut + sub and { shift unless length ref $_[0]; @@ -191,6 +253,12 @@ sub and { } } +=head2 C + +Returns a list built from C<@atoms> but where there's only one atom for a given category and name. + +=cut + sub fold { shift unless length ref $_[0]; @@ -205,4 +273,36 @@ sub fold { return values %seen; } -1; +=pod + +This class provides overloaded methods for numerical comparison, string comparison and strigification. + +=head1 SEE ALSO + +L, L. + +=head1 AUTHOR + +Vincent Pit, C<< >>, L. + +You can contact me by mail or on C (vincent). + +=head1 BUGS + +Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc CPANPLUS::Dist::Gentoo + +=head1 COPYRIGHT & LICENSE + +Copyright 2009 Vincent Pit, all rights reserved. + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut + +1; # End of CPANPLUS::Dist::Gentoo::Atom diff --git a/lib/CPANPLUS/Dist/Gentoo/Version.pm b/lib/CPANPLUS/Dist/Gentoo/Version.pm index 1214582..12f75d6 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Version.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Version.pm @@ -3,6 +3,24 @@ package CPANPLUS::Dist::Gentoo::Version; use strict; use warnings; +=head1 NAME + +CPANPLUS::Dist::Gentoo::Version - Gentoo version object. + +=head1 VERSION + +Version 0.08 + +=cut + +our $VERSION = '0.08'; + +=head1 DESCRIPTION + +This class models Gentoo versions. + +=cut + use Scalar::Util (); use overload ( @@ -10,13 +28,19 @@ use overload ( '""' => \&_stringify, ); -our $VERSION = '0.08'; - my $int_rx = qr/\d+/; my $dotted_num_rx = qr/$int_rx(?:\.$int_rx)*/; our $version_rx = qr/$dotted_num_rx(?:_p$dotted_num_rx)?(?:-r$int_rx)?/; +=head1 METHODS + +=head2 C + +Creates a new L object from the version string C<$vstring>. + +=cut + sub new { my $class = shift; $class = ref($class) || $class; @@ -45,6 +69,20 @@ BEGIN { eval "sub $_ { \$_[0]->{$_} }" for @parts; } +=head2 C + +Read-only accessor for the C part of the version object. + +=head2 C + +Read-only accessor for the C part of the version object. + +=head2 C + +Read-only accessor for the C part of the version object. + +=cut + sub _spaceship { my ($v1, $v2, $r) = @_; @@ -80,4 +118,36 @@ sub _stringify { $version; } -1; +=pod + +This class provides overloaded methods for numerical comparison and strigification. + +=head1 SEE ALSO + +L. + +=head1 AUTHOR + +Vincent Pit, C<< >>, L. + +You can contact me by mail or on C (vincent). + +=head1 BUGS + +Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc CPANPLUS::Dist::Gentoo + +=head1 COPYRIGHT & LICENSE + +Copyright 2009 Vincent Pit, all rights reserved. + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut + +1; # End of CPANPLUS::Dist::Gentoo::Version