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 2     2   25559 use v5.14.0;
  2         6  
  2         81  
2 2     2   10 use warnings;
  2         4  
  2         113  
3              
4             package OS::Package::Maintainer;
5              
6             # ABSTRACT: OS::Package::Maintainer object.
7             our $VERSION = '0.2.6'; # VERSION
8              
9 2     2   757 use Moo;
  2         15439  
  2         16  
10 2     2   2016 use Types::Standard qw( Str Enum );
  2         65216  
  2         22  
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__