File Coverage

blib/lib/URI/cpan/author.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 23 27 85.1


line stmt bran cond sub pod time code
1 1     1   3 use strict;
  1         1  
  1         23  
2 1     1   3 use warnings;
  1         1  
  1         30  
3              
4             package URI::cpan::author;
5             $URI::cpan::author::VERSION = '1.007';
6 1     1   3 use parent qw(URI::cpan);
  1         1  
  1         3  
7              
8             sub validate {
9 1     1 0 2 my ($self) = @_;
10              
11 1         5 my ($author, @rest) = split m{/}, $self->_p_rel;
12              
13 1 50       4 Carp::croak "invalid cpan URI: trailing path elements in $self" if @rest;
14              
15 1 50       4 Carp::croak "invalid cpan URI: invalid author part in $self"
16             unless $author =~ m{\A[A-Z]+\z};
17             }
18              
19             sub author {
20 1     1 0 297 my ($self) = @_;
21 1         3 my ($author) = split m{/}, $self->_p_rel;
22 1         3 return $author;
23             }
24              
25             1;
26              
27             __END__