=head1 NAME
-CPANPLUS::Dist::Gentoo::Version - Gentoo atom object.
+CPANPLUS::Dist::Gentoo::Atom - Gentoo atom object.
=head1 VERSION
-Version 0.08
+Version 0.10
=cut
-our $VERSION = '0.08';
+our $VERSION = '0.10';
=head1 DESCRIPTION
use CPANPLUS::Dist::Gentoo::Version;
-my $version_rx = $CPANPLUS::Dist::Gentoo::Version::version_rx;
+my $range_rx = qr/(?:<|<=|=|>=|>)/;
+my $name_rx = qr/[a-zA-Z0-9_+-]+/;
+my $category_rx = $name_rx;
+my $version_rx = $CPANPLUS::Dist::Gentoo::Version::version_rx;
=head1 METHODS
if (defined $args{name}) {
($range, $category, $name, $version) = @args{qw/range category name version/};
Carp::confess('Category unspecified') unless defined $category;
- /[^\w-]/ and Carp::confess('Invalid argument') for $name, $category;
+ Carp::confess('Invalid category') unless $category =~ /^$category_rx$/o;
+ Carp::confess('Invalid name') unless $name =~ /^$name_rx$/o;
} elsif (defined $args{atom}) {
my $atom = $args{atom};
- $atom =~ m{^(<|<=|=|>=|>)?([\w-]+)/([\w-]+)(?-v?($version_rx))?$}
+ $atom =~ m{^($range_rx)?($category_rx)/($name_rx)(?:-v?($version_rx))?$}o
or Carp::confess('Invalid atom');
($range, $category, $name, $version) = ($1, $2, $3, $4);
} else {
if (defined $version) {
if (defined $range) {
- Carp::confess("Invalid range $range")
- unless grep $range eq $_, qw|< <= = >= >|;
+ Carp::confess("Invalid range $range") unless $range =~ /^$range_rx$/o;
} else {
- $range = '=';
+ $range = '>=';
}
} else {
Carp::confess('Range atoms require a valid version')
my $ebuild = shift;
$ebuild = '' unless defined $ebuild;
- $ebuild =~ m{/([\w-]+)/([\w-]+)/\2-v?($version_rx)\.ebuild$}
+ $ebuild =~ m{/($category_rx)/($name_rx)/\2-v?($version_rx)\.ebuild$}o
or Carp::confess('Invalid ebuild');
my ($category, $name, $version) = ($1, $2, $3);
=head1 BUGS
-Please report any bugs or feature requests to C<bug-cpanplus-dist-gentoo at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPANPLUS-Dist-Gentoo>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
+Please report any bugs or feature requests to C<bug-cpanplus-dist-gentoo at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPANPLUS-Dist-Gentoo>.
+I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
=head1 COPYRIGHT & LICENSE
-Copyright 2009 Vincent Pit, all rights reserved.
+Copyright 2009,2010 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.