File Coverage

blib/lib/App/SpamcupNG/Error/Mailhost.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 5 5 100.0
pod 2 2 100.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             use strict;
2 13     13   357 use warnings;
  13         17  
  13         333  
3 13     13   49 use parent 'App::SpamcupNG::Error';
  13         20  
  13         251  
4 13     13   3143  
  13         1909  
  13         80  
5             our $VERSION = '0.015'; # VERSION
6              
7             =head1 NAME
8              
9             App::SpamcupNG::Error::Mailhost - representation of a Spamcop mailhost
10             configuration error.
11              
12             =head1 SYNOPSIS
13              
14             See L<App::SpamcupNG::Error::Factory> to create an instance of this class.
15              
16             =head1 DESCRIPTION
17              
18             =head1 METHODS
19              
20             =head2 new
21              
22             Creates a new instance. Expects as parameter an array reference which every
23             index is a string of the message.
24              
25             =cut
26              
27             my ( $class, $message_ref ) = @_;
28             die 'message must be an array reference with size = 3'
29 3     3 1 69 unless ( ( ref($message_ref) eq 'ARRAY' )
30             and ( scalar( @{$message_ref} ) == 3 ) );
31              
32 3 100 66     11 return $class->SUPER::new($message_ref);
  3         18  
33             }
34 2         15  
35             =head2 message
36              
37             Overrided from superclass, with required additional parsing.
38              
39             =cut
40              
41             my $self = shift;
42             my @temp = @{ $self->{message} };
43             $temp[0] = $temp[0] . '.';
44 1     1 1 1089 $temp[2] = lc( $temp[2] ) . '.';
45 1         2 return join( ' ', @temp );
  1         5  
46 1         4 }
47 1         3  
48 1         6 =head1 AUTHOR
49              
50             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>
51              
52             =head1 COPYRIGHT AND LICENSE
53              
54             This software is copyright (c) 2018 of Alceu Rodrigues de Freitas Junior,
55             E<lt>arfreitas@cpan.orgE<gt>
56              
57             This file is part of App-SpamcupNG distribution.
58              
59             App-SpamcupNG is free software: you can redistribute it and/or modify it under
60             the terms of the GNU General Public License as published by the Free Software
61             Foundation, either version 3 of the License, or (at your option) any later
62             version.
63              
64             App-SpamcupNG is distributed in the hope that it will be useful, but WITHOUT
65             ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
66             FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
67              
68             You should have received a copy of the GNU General Public License along with
69             App-SpamcupNG. If not, see <http://www.gnu.org/licenses/>.
70              
71             =cut
72              
73             1;