← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Sun Nov 5 03:09:29 2017
Reported on Mon Nov 6 13:20:51 2017

Filename/usr/local/lib/perl5/site_perl/Mail/SpamAssassin/PersistentAddrList.pm
StatementsExecuted 17 statements in 898µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11142µs53µsMail::SpamAssassin::PersistentAddrList::::BEGIN@49Mail::SpamAssassin::PersistentAddrList::BEGIN@49
11136µs41µsMail::SpamAssassin::PersistentAddrList::::BEGIN@51Mail::SpamAssassin::PersistentAddrList::BEGIN@51
11129µs104µsMail::SpamAssassin::PersistentAddrList::::BEGIN@54Mail::SpamAssassin::PersistentAddrList::BEGIN@54
11127µs87µsMail::SpamAssassin::PersistentAddrList::::BEGIN@52Mail::SpamAssassin::PersistentAddrList::BEGIN@52
11124µs61µsMail::SpamAssassin::PersistentAddrList::::BEGIN@50Mail::SpamAssassin::PersistentAddrList::BEGIN@50
11123µs23µsMail::SpamAssassin::PersistentAddrList::::newMail::SpamAssassin::PersistentAddrList::new
0000s0sMail::SpamAssassin::PersistentAddrList::::add_scoreMail::SpamAssassin::PersistentAddrList::add_score
0000s0sMail::SpamAssassin::PersistentAddrList::::finishMail::SpamAssassin::PersistentAddrList::finish
0000s0sMail::SpamAssassin::PersistentAddrList::::get_addr_entryMail::SpamAssassin::PersistentAddrList::get_addr_entry
0000s0sMail::SpamAssassin::PersistentAddrList::::new_checkerMail::SpamAssassin::PersistentAddrList::new_checker
0000s0sMail::SpamAssassin::PersistentAddrList::::remove_entryMail::SpamAssassin::PersistentAddrList::remove_entry
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# <@LICENSE>
2# Licensed to the Apache Software Foundation (ASF) under one or more
3# contributor license agreements. See the NOTICE file distributed with
4# this work for additional information regarding copyright ownership.
5# The ASF licenses this file to you under the Apache License, Version 2.0
6# (the "License"); you may not use this file except in compliance with
7# the License. You may obtain a copy of the License at:
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# </@LICENSE>
17
18=head1 NAME
19
20Mail::SpamAssassin::PersistentAddrList - persistent address list base class
21
22=head1 SYNOPSIS
23
24 my $factory = PersistentAddrListSubclass->new();
25 $spamtest->set_persistent_addr_list_factory ($factory);
26 ... call into SpamAssassin classes...
27
28SpamAssassin will call:
29
30 my $addrlist = $factory->new_checker($spamtest);
31 $entry = $addrlist->get_addr_entry ($addr);
32 ...
33
34=head1 DESCRIPTION
35
36All persistent address list implementations, used by the auto-whitelist
37code to track known-good email addresses, use this as a base class.
38
39See C<Mail::SpamAssassin::DBBasedAddrList> for an example.
40
41=head1 METHODS
42
43=over 4
44
45=cut
46
47package Mail::SpamAssassin::PersistentAddrList;
48
49272µs263µs
# spent 53µs (42+10) within Mail::SpamAssassin::PersistentAddrList::BEGIN@49 which was called: # once (42µs+10µs) by Mail::SpamAssassin::DBBasedAddrList::BEGIN@26 at line 49
use strict;
# spent 53µs making 1 call to Mail::SpamAssassin::PersistentAddrList::BEGIN@49 # spent 10µs making 1 call to strict::import
50269µs298µs
# spent 61µs (24+37) within Mail::SpamAssassin::PersistentAddrList::BEGIN@50 which was called: # once (24µs+37µs) by Mail::SpamAssassin::DBBasedAddrList::BEGIN@26 at line 50
use warnings;
# spent 61µs making 1 call to Mail::SpamAssassin::PersistentAddrList::BEGIN@50 # spent 37µs making 1 call to warnings::import
51269µs246µs
# spent 41µs (36+5) within Mail::SpamAssassin::PersistentAddrList::BEGIN@51 which was called: # once (36µs+5µs) by Mail::SpamAssassin::DBBasedAddrList::BEGIN@26 at line 51
use bytes;
# spent 41µs making 1 call to Mail::SpamAssassin::PersistentAddrList::BEGIN@51 # spent 5µs making 1 call to bytes::import
52291µs2147µs
# spent 87µs (27+60) within Mail::SpamAssassin::PersistentAddrList::BEGIN@52 which was called: # once (27µs+60µs) by Mail::SpamAssassin::DBBasedAddrList::BEGIN@26 at line 52
use re 'taint';
# spent 87µs making 1 call to Mail::SpamAssassin::PersistentAddrList::BEGIN@52 # spent 60µs making 1 call to re::import
53
5412µs
# spent 104µs (29+75) within Mail::SpamAssassin::PersistentAddrList::BEGIN@54 which was called: # once (29µs+75µs) by Mail::SpamAssassin::DBBasedAddrList::BEGIN@26 at line 56
use vars qw{
55 @ISA
561534µs2179µs};
# spent 104µs making 1 call to Mail::SpamAssassin::PersistentAddrList::BEGIN@54 # spent 75µs making 1 call to vars::import
57
58118µs@ISA = qw();
59
60###########################################################################
61
62=item $factory = PersistentAddrListSubclass->new();
63
64This creates a factory object, which SpamAssassin will call to create
65a new checker object for the persistent address list.
66
67=cut
68
69
# spent 23µs within Mail::SpamAssassin::PersistentAddrList::new which was called: # once (23µs+0s) by Mail::SpamAssassin::DBBasedAddrList::new at line 37 of Mail/SpamAssassin/DBBasedAddrList.pm
sub new {
7012µs my $class = shift;
7112µs $class = ref($class) || $class;
72112µs my $self = { };
7312µs bless ($self, $class);
74116µs $self;
75}
76
77###########################################################################
78
79=item my $addrlist = $factory->new_checker();
80
81Create a new address-list checker object from the factory. Called by the
82SpamAssassin classes.
83
84=cut
85
86sub new_checker {
87 my ($factory, $main) = @_;
88 die "auto-whitelist: unimplemented base method"; # override this
89}
90
91###########################################################################
92
93=item $entry = $addrlist->get_addr_entry ($addr);
94
95Given an email address C<$addr>, return an entry object with the details of
96that address.
97
98The entry object is a reference to a hash, which must contain at least
99two keys: C<count>, which is the count of times that address has been
100encountered before; and C<totscore>, which is the total of all scores for
101messages associated with that address. From these two fields, an average
102score will be calculated, and the score for the current message will be
103regressed towards that mean message score.
104
105The hash can contain whatever other data your back-end needs to store,
106under other keys.
107
108The method should never return C<undef>, or a hash that does not contain
109a C<count> key and a C<totscore> key.
110
111=cut
112
113sub get_addr_entry {
114 my ($self, $addr, $signedby) = @_;
115 my $entry = { };
116 die "auto-whitelist: unimplemented base method"; # override this
117 return $entry;
118}
119
120###########################################################################
121
122=item $entry = $addrlist->add_score($entry, $score);
123
124This method should add the given score to the whitelist database for the
125given entry, and then return the new entry.
126
127=cut
128
129sub add_score {
130 my ($self, $entry, $score) = @_;
131 die "auto-whitelist: unimplemented base method"; # override this
132}
133
134###########################################################################
135
136=item $entry = $addrlist->remove_entry ($entry);
137
138This method should remove the given entry from the whitelist database.
139
140=cut
141
142sub remove_entry {
143 my ($self, $entry) = @_;
144 die "auto-whitelist: unimplemented base method"; # override this
145}
146
147###########################################################################
148
149=item $entry = $addrlist->finish ();
150
151Clean up, if necessary. Called by SpamAssassin when it has finished
152checking, or adding to, the auto-whitelist database.
153
154=cut
155
156sub finish {
157 my ($self) = @_;
158}
159
160###########################################################################
161
16219µs1;
163
164=back
165
166=cut