line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use warnings; |
2
|
7
|
|
|
7
|
|
40
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
220
|
|
3
|
7
|
|
|
7
|
|
30
|
use parent qw(Class::Accessor); |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
139
|
|
4
|
7
|
|
|
7
|
|
27
|
use Hash::Util 'lock_hash'; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
161
|
|
5
|
7
|
|
|
7
|
|
412
|
use Carp 'confess'; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
35
|
|
6
|
7
|
|
|
7
|
|
314
|
|
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
303
|
|
7
|
|
|
|
|
|
|
use App::SpamcupNG::Summary; |
8
|
7
|
|
|
7
|
|
35
|
|
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
54
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.015'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=pod |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
App::SpamcupNG::Summary::Receiver - representation of a SPAM report receiver |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This class was created to facilitate the handling of submitted SPAM reports for |
20
|
|
|
|
|
|
|
the interested parties. Sometimes a party doesn't actually receive a report and |
21
|
|
|
|
|
|
|
that is expected by design. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=over |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item email: the "e-mail" of the report |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item report_id: the ID of the sent report |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=back |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Sometimes a SPAM report is not sent to an e-mail address, Spamcop calls that |
34
|
|
|
|
|
|
|
"devnull'ing": the report is just stored for statistical reasons, no real |
35
|
|
|
|
|
|
|
e-mail address receive the report. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
In those cases, only the indication of the domain that would receive the SPAM |
38
|
|
|
|
|
|
|
report is stored, without a report sent ID (actually this ID exists, but the |
39
|
|
|
|
|
|
|
web interface does not exports that info). |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# TODO: follow best practice |
44
|
|
|
|
|
|
|
my @fields = ( 'email', 'report_id' ); |
45
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors(@fields); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 new |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Creates a new instance. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Expects as parameter a array reference, where the first index is the "email" |
54
|
|
|
|
|
|
|
and the second the SPAM report sent ID. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
The first parameter cannot be C<undef>, while the second is acceptabled. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my ( $class, $attribs_ref ) = @_; |
61
|
|
|
|
|
|
|
confess 'Expects an array reference as parameter' |
62
|
8
|
|
|
8
|
1
|
15
|
unless ( ref($attribs_ref) eq 'ARRAY' ); |
63
|
8
|
50
|
|
|
|
18
|
confess 'email cannot be undef' unless ( $attribs_ref->[0] ); |
64
|
|
|
|
|
|
|
|
65
|
8
|
50
|
|
|
|
15
|
my $self = { |
66
|
|
|
|
|
|
|
report_id => $attribs_ref->[1], |
67
|
8
|
|
|
|
|
19
|
email => $attribs_ref->[0], |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
bless $self, $class; |
71
|
|
|
|
|
|
|
lock_hash( %{$self} ); |
72
|
8
|
|
|
|
|
12
|
return $self; |
73
|
8
|
|
|
|
|
10
|
} |
|
8
|
|
|
|
|
36
|
|
74
|
8
|
|
|
|
|
130
|
|
75
|
|
|
|
|
|
|
=head2 as_text |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns the receiver attributes as strings, separated by commas. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
If some of attributes are C<undef>, the string C<not avaialable> will be used |
80
|
|
|
|
|
|
|
instead. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $self = shift; |
85
|
|
|
|
|
|
|
my @dump; |
86
|
|
|
|
|
|
|
push( @dump, $self->{email} ); |
87
|
9
|
|
|
9
|
1
|
12
|
push( @dump, ( $self->{report_id} || App::SpamcupNG::Summary->na ) ); |
88
|
9
|
|
|
|
|
9
|
return join( ',', @dump ); |
89
|
9
|
|
|
|
|
15
|
} |
90
|
9
|
|
66
|
|
|
22
|
|
91
|
9
|
|
|
|
|
31
|
=head2 is_devnulled |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns true (1) if the receiver was stored for statistics only or if it was |
94
|
|
|
|
|
|
|
indeed reported to a domain, false (0) otherwise. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
my $self = shift; |
99
|
|
|
|
|
|
|
return defined( $self->{report_id} ) ? 0 : 1; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
0
|
1
|
|
=head1 SEE ALSO |
103
|
0
|
0
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=over |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item * |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
L<Class::Accessor> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHOR |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This software is copyright (c) 2018 of Alceu Rodrigues de Freitas Junior, |
119
|
|
|
|
|
|
|
E<lt>arfreitas@cpan.orgE<gt> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This file is part of App-SpamcupNG distribution. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
App-SpamcupNG is free software: you can redistribute it and/or modify it under |
124
|
|
|
|
|
|
|
the terms of the GNU General Public License as published by the Free Software |
125
|
|
|
|
|
|
|
Foundation, either version 3 of the License, or (at your option) any later |
126
|
|
|
|
|
|
|
version. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
App-SpamcupNG is distributed in the hope that it will be useful, but WITHOUT |
129
|
|
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
130
|
|
|
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with |
133
|
|
|
|
|
|
|
App-SpamcupNG. If not, see <http://www.gnu.org/licenses/>. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |