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