line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use strict; |
2
|
13
|
|
|
13
|
|
79965
|
use warnings; |
|
13
|
|
|
|
|
30
|
|
|
13
|
|
|
|
|
288
|
|
3
|
13
|
|
|
13
|
|
47
|
|
|
13
|
|
|
|
|
20
|
|
|
13
|
|
|
|
|
2658
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.015'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
App::SpamcupNG::Error - base class for Spamcop website errors |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use parent 'App::SpamcupNG::Error'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This is a base class to represent error messages after parsing Spamcop HTML. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 METHODS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 new |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Creates a new instance. Instances of C<App::Spamcup::Error> shouldn't be |
23
|
|
|
|
|
|
|
created directly, use one of the subclasses of it. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Expect as parameters: |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
- an array reference containing all the strings from the original message. - a |
28
|
|
|
|
|
|
|
scalar with 0 or 1 to indicate that the message should be considered fatal or |
29
|
|
|
|
|
|
|
not. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
A message parsed from Spamcop website HTML that should stop the SPAM processing |
32
|
|
|
|
|
|
|
should be considered as fatal. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my ( $class, $message_ref, $is_fatal ) = @_; |
37
|
|
|
|
|
|
|
$is_fatal //= 0; |
38
|
13
|
|
|
13
|
1
|
1171
|
|
39
|
13
|
|
100
|
|
|
37
|
die 'message must be an non empty array reference' |
40
|
|
|
|
|
|
|
unless ( ( ref($message_ref) eq 'ARRAY' ) |
41
|
|
|
|
|
|
|
and ( scalar( @{$message_ref} ) > 0 ) ); |
42
|
|
|
|
|
|
|
|
43
|
13
|
100
|
100
|
|
|
45
|
for ( my $i = 0 ; $i < scalar( @{$message_ref} ) ; $i++ ) { |
|
11
|
|
|
|
|
34
|
|
44
|
|
|
|
|
|
|
$message_ref->[$i] =~ s/^\s+//; |
45
|
10
|
|
|
|
|
18
|
$message_ref->[$i] =~ s/\s+$//; |
|
26
|
|
|
|
|
43
|
|
46
|
16
|
|
|
|
|
37
|
} |
47
|
16
|
|
|
|
|
58
|
|
48
|
|
|
|
|
|
|
my $self = { |
49
|
|
|
|
|
|
|
message => $message_ref, |
50
|
10
|
|
|
|
|
26
|
is_fatal => $is_fatal |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
bless( $self, $class ); |
54
|
|
|
|
|
|
|
return $self; |
55
|
10
|
|
|
|
|
15
|
} |
56
|
10
|
|
|
|
|
38
|
|
57
|
|
|
|
|
|
|
=head2 message |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Returns the message associated with the error. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $self = shift; |
64
|
|
|
|
|
|
|
return $self->{message}->[0]; |
65
|
|
|
|
|
|
|
} |
66
|
4
|
|
|
4
|
1
|
673
|
|
67
|
4
|
|
|
|
|
19
|
=head2 is_fatal |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Returns 0 if the error is not fatal, 1 otherwise. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $self = shift; |
74
|
|
|
|
|
|
|
return $self->{is_fatal}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
10
|
|
|
10
|
1
|
2852
|
=head1 AUTHOR |
78
|
10
|
|
|
|
|
45
|
|
79
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This software is copyright (c) 2018 of Alceu Rodrigues de Freitas Junior, |
84
|
|
|
|
|
|
|
E<lt>arfreitas@cpan.orgE<gt> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This file is part of App-SpamcupNG distribution. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
App-SpamcupNG is free software: you can redistribute it and/or modify it under |
89
|
|
|
|
|
|
|
the terms of the GNU General Public License as published by the Free Software |
90
|
|
|
|
|
|
|
Foundation, either version 3 of the License, or (at your option) any later |
91
|
|
|
|
|
|
|
version. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
App-SpamcupNG is distributed in the hope that it will be useful, but WITHOUT |
94
|
|
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
95
|
|
|
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with |
98
|
|
|
|
|
|
|
App-SpamcupNG. If not, see <http://www.gnu.org/licenses/>. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |