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   8 use strict;
  1         1  
  1         33  
2 1     1   5 use warnings;
  1         2  
  1         42  
3              
4             package URI::cpan::author 1.008;
5              
6 1     1   6 use parent qw(URI::cpan);
  1         2  
  1         5  
7              
8             sub validate {
9 1     1 0 2 my ($self) = @_;
10              
11 1         7 my ($author, @rest) = split m{/}, $self->_p_rel;
12              
13 1 50       5 Carp::croak "invalid cpan URI: trailing path elements in $self" if @rest;
14              
15 1 50       7 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 349 my ($self) = @_;
21 1         4 my ($author) = split m{/}, $self->_p_rel;
22 1         5 return $author;
23             }
24              
25             1;
26              
27             __END__