File Coverage

blib/lib/OS/Package/Maintainer.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 6 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 33 51.5


line stmt bran cond sub pod time code
1 5     5   14158 use v5.14.0;
  5         13  
  5         164  
2 5     5   26 use warnings;
  5         5  
  5         223  
3              
4             package OS::Package::Maintainer;
5              
6             # ABSTRACT: OS::Package::Maintainer object.
7             our $VERSION = '0.2.7'; # VERSION
8              
9 5     5   491 use Moo;
  5         11306  
  5         33  
10 5     5   2828 use Types::Standard qw( Str Enum );
  5         51119  
  5         42  
11              
12             has author => ( is => 'rw', isa => Str, required => 1 );
13              
14             has company => (
15             is => 'rw',
16             isa => Str,
17             default => sub { my $self = shift; return $self->author }
18             );
19              
20             has [qw/nickname email phone/] => ( is => 'rw', isa => Str );
21              
22             sub by_line {
23 0     0 1   my $self = shift;
24              
25 0           my $by_line = $self->author;
26              
27 0 0         if ( defined $self->nickname ) {
28 0           $by_line .= sprintf ' (%s)', $self->nickname;
29             }
30              
31 0 0         if ( defined $self->email ) {
32 0           $by_line .= sprintf ' <%s>', $self->email;
33             }
34              
35 0 0         if ( defined $self->phone ) {
36 0           $by_line .= sprintf ' %s', $self->phone;
37             }
38              
39 0           return $by_line;
40              
41             }
42              
43             1;
44              
45             __END__