← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Sun Nov 5 02:36:06 2017
Reported on Sun Nov 5 02:56:20 2017

Filename/usr/local/lib/perl5/site_perl/Mail/SpamAssassin/Plugin.pm
StatementsExecuted 1591 statements in 18.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
192139223.91ms6.35msMail::SpamAssassin::Plugin::::register_eval_ruleMail::SpamAssassin::Plugin::register_eval_rule
501113.13ms3.13msMail::SpamAssassin::Plugin::::inhibit_further_callbacksMail::SpamAssassin::Plugin::inhibit_further_callbacks
272727671µs671µsMail::SpamAssassin::Plugin::::newMail::SpamAssassin::Plugin::new
11131µs31µsMail::SpamAssassin::Plugin::::BEGIN@97Mail::SpamAssassin::Plugin::BEGIN@97
11128µs93µsMail::SpamAssassin::Plugin::::BEGIN@103Mail::SpamAssassin::Plugin::BEGIN@103
11127µs41µsMail::SpamAssassin::Plugin::::BEGIN@100Mail::SpamAssassin::Plugin::BEGIN@100
11125µs155µsMail::SpamAssassin::Plugin::::BEGIN@105Mail::SpamAssassin::Plugin::BEGIN@105
11123µs30µsMail::SpamAssassin::Plugin::::BEGIN@102Mail::SpamAssassin::Plugin::BEGIN@102
11121µs216µsMail::SpamAssassin::Plugin::::BEGIN@98Mail::SpamAssassin::Plugin::BEGIN@98
11120µs60µsMail::SpamAssassin::Plugin::::BEGIN@101Mail::SpamAssassin::Plugin::BEGIN@101
0000s0sMail::SpamAssassin::Plugin::::finishMail::SpamAssassin::Plugin::finish
0000s0sMail::SpamAssassin::Plugin::::register_generated_rule_methodMail::SpamAssassin::Plugin::register_generated_rule_method
0000s0sMail::SpamAssassin::Plugin::::register_method_priorityMail::SpamAssassin::Plugin::register_method_priority
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::Plugin - SpamAssassin plugin base class
21
22=head1 SYNOPSIS
23
24=head2 SpamAssassin configuration:
25
26 loadplugin MyPlugin /path/to/myplugin.pm
27
28=head2 Perl code:
29
30 package MyPlugin;
31
32 use Mail::SpamAssassin::Plugin;
33 our @ISA = qw(Mail::SpamAssassin::Plugin);
34
35 sub new {
36 my ($class, $mailsa) = @_;
37
38 # the usual perlobj boilerplate to create a subclass object
39 $class = ref($class) || $class;
40 my $self = $class->SUPER::new($mailsa);
41 bless ($self, $class);
42
43 # then register an eval rule, if desired...
44 $self->register_eval_rule ("check_for_foo");
45
46 # and return the new plugin object
47 return $self;
48 }
49
50 ...methods...
51
52 1;
53
54=head1 DESCRIPTION
55
56This is the base class for SpamAssassin plugins; all plugins must be objects
57that implement this class.
58
59This class provides no-op stub methods for all the callbacks that a plugin
60can receive. It is expected that your plugin will override one or more
61of these stubs to perform its actions.
62
63SpamAssassin implements a plugin chain; each callback event is passed to each
64of the registered plugin objects in turn. Any plugin can call
65C<$self-E<gt>inhibit_further_callbacks()> to block delivery of that event to
66later plugins in the chain. This is useful if the plugin has handled the
67event, and there will be no need for later plugins to handle it as well.
68
69If you're looking to write a simple eval rule, skip straight to
70C<register_eval_rule()>, below.
71
72=head1 INTERFACE
73
74In all the plugin APIs below, C<options> refers to a reference to a hash
75containing name-value pairs. This is used to ensure future-compatibility, in
76that we can add new options in future without affecting objects built to an
77earlier version of the API.
78
79For example, here would be how to print out the C<line> item in a
80C<parse_config()> method:
81
82 sub parse_config {
83 my ($self, $opts) = @_;
84 print "MyPlugin: parse_config got ".$opts->{line}."\n";
85 }
86
87=head1 METHODS
88
89The following methods can be overridden by subclasses to handle events.
90
91=over 4
92
93=cut
94
95package Mail::SpamAssassin::Plugin;
96
97266µs131µs
# spent 31µs within Mail::SpamAssassin::Plugin::BEGIN@97 which was called: # once (31µs+0s) by Mail::SpamAssassin::PluginHandler::BEGIN@27 at line 97
use Mail::SpamAssassin;
# spent 31µs making 1 call to Mail::SpamAssassin::Plugin::BEGIN@97
98261µs2410µs
# spent 216µs (21+195) within Mail::SpamAssassin::Plugin::BEGIN@98 which was called: # once (21µs+195µs) by Mail::SpamAssassin::PluginHandler::BEGIN@27 at line 98
use Mail::SpamAssassin::Logger;
# spent 216µs making 1 call to Mail::SpamAssassin::Plugin::BEGIN@98 # spent 195µs making 1 call to Exporter::import
99
100264µs254µs
# spent 41µs (27+14) within Mail::SpamAssassin::Plugin::BEGIN@100 which was called: # once (27µs+14µs) by Mail::SpamAssassin::PluginHandler::BEGIN@27 at line 100
use strict;
# spent 41µs making 1 call to Mail::SpamAssassin::Plugin::BEGIN@100 # spent 14µs making 1 call to strict::import
101260µs299µs
# spent 60µs (20+39) within Mail::SpamAssassin::Plugin::BEGIN@101 which was called: # once (20µs+39µs) by Mail::SpamAssassin::PluginHandler::BEGIN@27 at line 101
use warnings;
# spent 60µs making 1 call to Mail::SpamAssassin::Plugin::BEGIN@101 # spent 39µs making 1 call to warnings::import
102264µs236µs
# spent 30µs (23+7) within Mail::SpamAssassin::Plugin::BEGIN@102 which was called: # once (23µs+7µs) by Mail::SpamAssassin::PluginHandler::BEGIN@27 at line 102
use bytes;
# spent 30µs making 1 call to Mail::SpamAssassin::Plugin::BEGIN@102 # spent 7µs making 1 call to bytes::import
103271µs2157µs
# spent 93µs (28+65) within Mail::SpamAssassin::Plugin::BEGIN@103 which was called: # once (28µs+65µs) by Mail::SpamAssassin::PluginHandler::BEGIN@27 at line 103
use re 'taint';
# spent 93µs making 1 call to Mail::SpamAssassin::Plugin::BEGIN@103 # spent 65µs making 1 call to re::import
104
10512µs
# spent 155µs (25+130) within Mail::SpamAssassin::Plugin::BEGIN@105 which was called: # once (25µs+130µs) by Mail::SpamAssassin::PluginHandler::BEGIN@27 at line 107
use vars qw{
106 @ISA $VERSION
10711.78ms2286µs};
# spent 155µs making 1 call to Mail::SpamAssassin::Plugin::BEGIN@105 # spent 130µs making 1 call to vars::import
108
10918µs@ISA = qw();
110#Removed $VERSION per BUG 6422
111#$VERSION = 'bogus';
112
113###########################################################################
114
115=item $plugin = MyPluginClass->new ($mailsaobject)
116
117Constructor. Plugins that need to register themselves will need to
118define their own; the default super-class constructor will work fine
119for plugins that just override a method.
120
121Note that subclasses must provide the C<$mailsaobject> to the
122superclass constructor, like so:
123
124 my $self = $class->SUPER::new($mailsaobject);
125
126Lifecycle note: plugins that will need to store per-scan state should not store
127that on the Plugin object; instead this should be stored on the PerMsgStatus
128object, see C<check_start()> below. It is also likewise recommended that
129configuration settings be stored on the Conf object; see C<parse_config()>.
130
131=cut
132
133
# spent 671µs within Mail::SpamAssassin::Plugin::new which was called 27 times, avg 25µs/call: # once (45µs+0s) by Mail::SpamAssassin::Plugin::MIMEHeader::new at line 84 of Mail/SpamAssassin/Plugin/MIMEHeader.pm # once (38µs+0s) by Mail::SpamAssassin::Plugin::WhiteListSubject::new at line 61 of Mail/SpamAssassin/Plugin/WhiteListSubject.pm # once (33µs+0s) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 39 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (32µs+0s) by Mail::SpamAssassin::Plugin::TxRep::new at line 219 of Mail/SpamAssassin/Plugin/TxRep.pm # once (30µs+0s) by Mail::SpamAssassin::Plugin::AutoLearnThreshold::new at line 69 of Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm # once (29µs+0s) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 100 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (29µs+0s) by Mail::SpamAssassin::Plugin::URIDetail::new at line 88 of Mail/SpamAssassin/Plugin/URIDetail.pm # once (28µs+0s) by Mail::SpamAssassin::Plugin::DNSEval::new at line 47 of Mail/SpamAssassin/Plugin/DNSEval.pm # once (26µs+0s) by Mail::SpamAssassin::Plugin::BodyEval::new at line 39 of Mail/SpamAssassin/Plugin/BodyEval.pm # once (25µs+0s) by Mail::SpamAssassin::Plugin::Check::new at line 41 of Mail/SpamAssassin/Plugin/Check.pm # once (25µs+0s) by Mail::SpamAssassin::Plugin::SpamCop::new at line 63 of Mail/SpamAssassin/Plugin/SpamCop.pm # once (24µs+0s) by Mail::SpamAssassin::Plugin::URIDNSBL::new at line 316 of Mail/SpamAssassin/Plugin/URIDNSBL.pm # once (24µs+0s) by Mail::SpamAssassin::Plugin::SPF::new at line 54 of Mail/SpamAssassin/Plugin/SPF.pm # once (23µs+0s) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 41 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (22µs+0s) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 41 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (22µs+0s) by Mail::SpamAssassin::Plugin::Hashcash::new at line 117 of Mail/SpamAssassin/Plugin/Hashcash.pm # once (22µs+0s) by Mail::SpamAssassin::Plugin::RelayEval::new at line 39 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (21µs+0s) by Mail::SpamAssassin::Plugin::DKIM::new at line 140 of Mail/SpamAssassin/Plugin/DKIM.pm # once (21µs+0s) by Mail::SpamAssassin::Plugin::HTTPSMismatch::new at line 37 of Mail/SpamAssassin/Plugin/HTTPSMismatch.pm # once (21µs+0s) by Mail::SpamAssassin::Plugin::URIEval::new at line 38 of Mail/SpamAssassin/Plugin/URIEval.pm # once (20µs+0s) by Mail::SpamAssassin::Plugin::Razor2::new at line 59 of Mail/SpamAssassin/Plugin/Razor2.pm # once (20µs+0s) by Mail::SpamAssassin::Plugin::AskDNS::new at line 209 of Mail/SpamAssassin/Plugin/AskDNS.pm # once (19µs+0s) by Mail::SpamAssassin::Plugin::FreeMail::new at line 151 of Mail/SpamAssassin/Plugin/FreeMail.pm # once (19µs+0s) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 38 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (19µs+0s) by Mail::SpamAssassin::Plugin::ReplaceTags::new at line 68 of Mail/SpamAssassin/Plugin/ReplaceTags.pm # once (18µs+0s) by Mail::SpamAssassin::Plugin::VBounce::new at line 43 of Mail/SpamAssassin/Plugin/VBounce.pm # once (17µs+0s) by Mail::SpamAssassin::Plugin::Bayes::new at line 236 of Mail/SpamAssassin/Plugin/Bayes.pm
sub new {
1342770µs my $class = shift;
1352752µs my $mailsaobject = shift;
1362768µs $class = ref($class) || $class;
137
1382754µs if (!defined $mailsaobject) {
139 die "plugin: usage: Mail::SpamAssassin::Plugin::new(class,mailsaobject)";
140 }
141
14227181µs my $self = {
143 main => $mailsaobject,
144 _inhibit_further_callbacks => 0
145 };
1462783µs bless ($self, $class);
14727422µs $self;
148}
149
150# ---------------------------------------------------------------------------
151# now list the supported methods we will call into. NOTE: we don't have
152# to implement them here, since the plugin can use "can()" to introspect
153# the object and determine if it's capable of calling the method anyway.
154# Nifty!
155
156=item $plugin->parse_config ( { options ... } )
157
158Parse a configuration line that hasn't already been handled. C<options>
159is a reference to a hash containing these options:
160
161=over 4
162
163=item line
164
165The line of configuration text to parse. This has leading and trailing
166whitespace, and comments, removed.
167
168=item key
169
170The configuration key; ie. the first "word" on the line.
171
172=item value
173
174The configuration value; everything after the first "word" and
175any whitespace after that.
176
177=item conf
178
179The C<Mail::SpamAssassin::Conf> object on which the configuration
180data should be stored.
181
182=item user_config
183
184A boolean: C<1> if reading a user's configuration, C<0> if reading the
185system-wide configuration files.
186
187=back
188
189If the configuration line was a setting that is handled by this plugin, the
190method implementation should call C<$self-E<gt>inhibit_further_callbacks()>.
191
192If the setting is not handled by this plugin, the method should return C<0> so
193that a later plugin may handle it, or so that SpamAssassin can output a warning
194message to the user if no plugin understands it.
195
196Lifecycle note: it is suggested that configuration be stored on the
197C<Mail::SpamAssassin::Conf> object in use, instead of the plugin object itself.
198That can be found as C<$plugin-E<gt>{main}-E<gt>{conf}>, or as "conf" in the
199C<$options> hash reference above. By storing it on C<conf>, this allows
200per-user and system-wide configuration precedence to be dealt with correctly.
201
202=item $plugin->finish_parsing_start ( { options ... } )
203
204Signals that the system-wide configuration has been completely read,
205but internal data structures are not yet created. It is possible to
206use this hook to dynamically change the configuration already read in
207or add new config options.
208
209C<options> is a reference to a hash containing these options:
210
211=over 4
212
213=item conf
214
215The C<Mail::SpamAssassin::Conf> object on which the configuration
216data should be stored.
217
218=back
219
220Note: there are no guarantees that the internal data structures of
221SpamAssassin will not change from release to release. In particular to
222this plugin hook, if you modify the rules data structures in a
223third-party plugin, all bets are off until such time that an API is
224present for modifying that configuration data.
225
226=item $plugin->finish_parsing_end ( { options ... } )
227
228Signals that the system-wide configuration parsing has just finished, and
229SpamAssassin is nearly ready to check messages.
230
231C<options> is a reference to a hash containing these options:
232
233=over 4
234
235=item conf
236
237The C<Mail::SpamAssassin::Conf> object on which the configuration
238data should be stored.
239
240=back
241
242Note: there are no guarantees that the internal data structures of
243SpamAssassin will not change from release to release. In particular to
244this plugin hook, if you modify the rules data structures in a
245third-party plugin, all bets are off until such time that an API is
246present for modifying that configuration data.
247
248=item $plugin->user_conf_parsing_start ( { options ... } )
249
250Signals that the per-user configuration has been completely read, but
251not converted to internal data structures. It is possible to use this
252hook to dynamically change the configuration already read in or add
253new config options.
254
255If C<allow_user_rules> is enabled in the configuration, it is possible
256that additional rules have been added since the C<finish_parsing_start>
257plugin hook invocation was called.
258
259=over 4
260
261=item conf
262
263The C<Mail::SpamAssassin::Conf> object on which the configuration
264data should be stored.
265
266=back
267
268Note: there are no guarantees that the internal data structures of
269SpamAssassin will not change from release to release. In particular to
270this plugin hook, if you modify the rules data structures in a
271third-party plugin, all bets are off until such time that an API is
272present for modifying that configuration data.
273
274=item $plugin->user_conf_parsing_end ( { options ... } )
275
276Signals that the per-user configuration parsing has just finished, and
277SpamAssassin is nearly ready to check messages. If C<allow_user_rules> is
278enabled in the configuration, it is possible that additional rules have been
279added since the C<finish_parsing_end> plugin hook invocation was called.
280
281C<options> is a reference to a hash containing these options:
282
283=over 4
284
285=item conf
286
287The C<Mail::SpamAssassin::Conf> object on which the configuration
288data should be stored.
289
290=back
291
292Note: there are no guarantees that the internal data structures of
293SpamAssassin will not change from release to release. In particular to
294this plugin hook, if you modify the rules data structures in a
295third-party plugin, all bets are off until such time that an API is
296present for modifying that configuration data.
297
298=item $plugin->signal_user_changed ( { options ... } )
299
300Signals that the current user has changed for a new one.
301
302=over 4
303
304=item username
305
306The new user's username.
307
308=item user_dir
309
310The new user's home directory. (equivalent to C<~>.)
311
312=item userstate_dir
313
314The new user's storage directory. (equivalent to C<~/.spamassassin>.)
315
316=back
317
318=item $plugin->services_authorized_for_username ( { options ... } )
319
320Validates that a given username is authorized to use certain services.
321
322In order to authorize a user, the plugin should first check that it can
323handle any of the services passed into the method and then set the value
324for each allowed service to true (or any non-negative value).
325
326The current supported services are: bayessql
327
328=over 4
329
330=item username
331
332A username
333
334=item services
335
336Reference to a hash containing the services you want to check.
337
338{
339
340 'bayessql' => 0
341
342}
343
344=item conf
345
346The C<Mail::SpamAssassin::Conf> object on which the configuration
347data should be stored.
348
349=back
350
351=item $plugin->compile_now_start ( { options ... } )
352
353This is called at the beginning of Mail::SpamAssassin::compile_now() so
354plugins can do any necessary initialization for multi-process
355SpamAssassin (such as spamd or mass-check -j).
356
357=over 4
358
359=item use_user_prefs
360
361The value of $use_user_prefs option in compile_now().
362
363=item keep_userstate
364
365The value of $keep_userstate option in compile_now().
366
367=back
368
369=item $plugin->compile_now_finish ( { options ... } )
370
371This is called at the end of Mail::SpamAssassin::compile_now() so
372plugins can do any necessary initialization for multi-process
373SpamAssassin (such as spamd or mass-check -j).
374
375=over 4
376
377=item use_user_prefs
378
379The value of $use_user_prefs option in compile_now().
380
381=item keep_userstate
382
383The value of $keep_userstate option in compile_now().
384
385=back
386
387=item $plugin->check_start ( { options ... } )
388
389Signals that a message check operation is starting.
390
391=over 4
392
393=item permsgstatus
394
395The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
396
397Lifecycle note: it is recommended that rules that need to track test state on a
398per-scan basis should store that state on this object, not on the plugin object
399itself, since the plugin object will be shared between all active scanners.
400
401The message being scanned is accessible through the
402C<$permsgstatus-E<gt>get_message()> API; there are a number of other public
403APIs on that object, too. See C<Mail::SpamAssassin::PerMsgStatus> perldoc.
404
405=back
406
407=item $plugin->check_main ( { options ... } )
408
409Signals that a message should be checked. Note that implementations of
410this hook should return C<1>.
411
412=over 4
413
414=item permsgstatus
415
416The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
417
418=back
419
420=item $plugin->check_tick ( { options ... } )
421
422Called periodically during a message check operation. A callback set for
423this method is a good place to run through an event loop dealing with
424network events triggered in a C<parse_metadata> method, for example.
425
426=over 4
427
428=item permsgstatus
429
430The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
431
432=back
433
434=item $plugin->check_post_dnsbl ( { options ... } )
435
436Called after the DNSBL results have been harvested. This is a good
437place to harvest your own asynchronously-started network lookups.
438
439=over 4
440
441=item permsgstatus
442
443The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
444
445=back
446
447=item $plugin->check_post_learn ( { options ... } )
448
449Called after auto-learning may (or may not) have taken place. If you
450wish to perform additional learning, whether or not auto-learning
451happens, this is the place to do it.
452
453=over 4
454
455=item permsgstatus
456
457The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
458
459=back
460
461=item $plugin->check_end ( { options ... } )
462
463Signals that a message check operation has just finished, and the
464results are about to be returned to the caller.
465
466=over 4
467
468=item permsgstatus
469
470The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
471The current score, names of rules that hit, etc. can be retrieved
472using the public APIs on this object.
473
474=back
475
476=item $plugin->finish_tests ( { options ... } )
477
478Called via C<Mail::SpamAssassin::finish>. This should clear up any tests that
479a plugin has added to the namespace.
480
481In certain circumstances, plugins may find it useful to compile
482perl functions from the ruleset, on the fly. It is important to
483remove these once the C<Mail::SpamAssassin> object is deleted,
484however, and this API allows this.
485
486Each plugin is responsible for its own generated perl functions.
487
488=over 4
489
490=item conf
491
492The C<Mail::SpamAssassin::Conf> object on which the configuration
493data should be stored.
494
495=back
496
497See also the C<register_generated_rule_method> helper API, below.
498
499=item $plugin->extract_metadata ( { options ... } )
500
501Signals that a message is being mined for metadata. Some plugins may wish
502to add their own metadata as well.
503
504=over 4
505
506=item msg
507
508The C<Mail::SpamAssassin::Message> object for this message.
509
510=item permsgstatus
511
512The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
513
514=back
515
516=item $plugin->parsed_metadata ( { options ... } )
517
518Signals that a message's metadata has been parsed, and can now be
519accessed by the plugin.
520
521=over 4
522
523=item permsgstatus
524
525The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
526
527=back
528
529=item $plugin->start_rules ( { options ... } )
530
531Called before testing a set of rules of a given type and priority.
532
533=over 4
534
535=item permsgstatus
536
537The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
538
539=item ruletype
540
541The type of the rules about to be performed.
542
543=item priority
544
545The priority level of the rules about to be performed.
546
547=back
548
549=item $plugin->hit_rule ( { options ... } )
550
551Called when a rule fires.
552
553=over 4
554
555=item permsgstatus
556
557The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
558
559=item ruletype
560
561The type of the rule that fired.
562
563=item rulename
564
565The name of the rule that fired.
566
567=item score
568
569The rule's score in the active scoreset.
570
571=back
572
573=item $plugin->ran_rule ( { options ... } )
574
575Called after a rule has been tested, whether or not it fired. When the
576rule fires, the hit_rule callback is always called before this.
577
578=over 4
579
580=item permsgstatus
581
582The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
583
584=item ruletype
585
586The type of the rule that was tested.
587
588=item rulename
589
590The name of the rule that was tested.
591
592=back
593
594=item $plugin->autolearn_discriminator ( { options ... } )
595
596Control whether a just-scanned message should be learned as either
597spam or ham. This method should return one of C<1> to learn
598the message as spam, C<0> to learn as ham, or C<undef> to not
599learn from the message at all.
600
601=over 4
602
603=item permsgstatus
604
605The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
606
607=back
608
609=item $plugin->autolearn ( { options ... } )
610
611Signals that a message is about to be auto-learned as either ham or spam.
612
613=over 4
614
615=item permsgstatus
616
617The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
618
619=item isspam
620
621C<1> if the message is spam, C<0> if ham.
622
623=back
624
625=item $plugin->per_msg_finish ( { options ... } )
626
627Signals that a C<Mail::SpamAssassin::PerMsgStatus> object is being
628destroyed, and any per-scan context held on that object by this
629plugin should be destroyed as well.
630
631Normally, any member variables on the C<PerMsgStatus> object will be cleaned up
632automatically -- but if your plugin has made a circular reference on that
633object, this is the place to break them so that garbage collection can operate
634correctly.
635
636=over 4
637
638=item permsgstatus
639
640The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
641
642=back
643
644
645=item $plugin->have_shortcircuited ( { options ... } )
646
647Has the current scan operation 'short-circuited'? In other words, can
648further scanning be skipped, since the message is already definitively
649classified as either spam or ham?
650
651Plugins should return C<0> to indicate that scanning should continue,
652or C<1> to indicate that short-circuiting has taken effect.
653
654=over 4
655
656=item permsgstatus
657
658The C<Mail::SpamAssassin::PerMsgStatus> context object for this scan.
659
660=back
661
662=item $plugin->bayes_learn ( { options ... } )
663
664Called at the end of a bayes learn operation.
665
666This phase is the best place to map the raw (original) token value
667to the SHA1 hashed value.
668
669=over 4
670
671=item toksref
672
673Reference to hash returned by call to tokenize. The hash takes the
674format of:
675
676 {
677 'SHA1 Hash Value' => 'raw (original) value',
678 ...
679 }
680
681NOTE: This data structure has changed since it was originally introduced
682in version 3.0.0. The values are no longer perl anonymous hashes, they
683are a single string containing the raw token value. You can test for
684backward compatibility by checking to see if the value for a key is a
685reference to a perl HASH, for instance:
686
687if (ref($toksref->{$sometokenkey}) eq 'HASH') {...
688
689If it is, then you are using the old interface, otherwise you are using
690the current interface.
691
692=item isspam
693
694Boolean value stating what flavor of message the tokens represent, if
695true then message was specified as spam, false is nonspam. Note, when
696function is scan then isspam value is not valid.
697
698=item msgid
699
700Generated message id of the message just learned.
701
702=item msgatime
703
704Received date of the current message or current time if received date
705could not be determined. In addition, if the receive date is more than
70624 hrs into the future it will be reset to current datetime.
707
708=back
709
710=item $plugin->bayes_forget ( { options ... } )
711
712Called at the end of a bayes forget operation.
713
714=over 4
715
716=item toksref
717
718Reference to hash returned by call to tokenize. See bayes_learn
719documentation for additional information on the format.
720
721=item isspam
722
723Boolean value stating what flavor of message the tokens represent, if
724true then message was specified as spam, false is nonspam. Note, when
725function is scan then isspam value is not valid.
726
727=item msgid
728
729Generated message id of the message just forgotten.
730
731=back
732
733=item $plugin->bayes_scan ( { options ... } )
734
735Called at the end of a bayes scan operation. NOTE: Will not be
736called in case of error or if the message is otherwise skipped.
737
738=over 4
739
740=item toksref
741
742Reference to hash returned by call to tokenize. See bayes_learn
743documentation for additional information on the format.
744
745=item probsref
746
747Reference to hash of calculated probabilities for tokens found in
748the database.
749
750 {
751 'SHA1 Hash Value' => {
752 'prob' => 'calculated probability',
753 'spam_count' => 'Total number of spam msgs w/ token',
754 'ham_count' => 'Total number of ham msgs w/ token',
755 'atime' => 'Atime value for token in database'
756 }
757 }
758
759=item score
760
761Score calculated for this particular message.
762
763=item msgatime
764
765Calculated atime of the message just learned, note it may have been adjusted
766if it was determined to be too far into the future.
767
768=item significant_tokens
769
770Array ref of the tokens found to be significant in determining the score for
771this message.
772
773=back
774
775=item $plugin->plugin_report ( { options ... } )
776
777Called if the message is to be reported as spam. If the reporting system is
778available, the variable C<$options-E<gt>{report}-E<gt>report_available}> should
779be set to C<1>; if the reporting system successfully reported the message, the
780variable C<$options-E<gt>{report}-E<gt>report_return}> should be set to C<1>.
781
782=over 4
783
784=item report
785
786Reference to the Reporter object (C<$options-E<gt>{report}> in the
787paragraph above.)
788
789=item text
790
791Reference to a markup removed copy of the message in scalar string format.
792
793=item msg
794
795Reference to the original message object.
796
797=back
798
799=item $plugin->plugin_revoke ( { options ... } )
800
801Called if the message is to be reported as ham (revokes a spam report). If the
802reporting system is available, the variable
803C<$options-E<gt>{revoke}-E<gt>revoke_available}> should be set to C<1>; if the
804reporting system successfully revoked the message, the variable
805C<$options-E<gt>{revoke}-E<gt>revoke_return}> should be set to C<1>.
806
807=over 4
808
809=item revoke
810
811Reference to the Reporter object (C<$options-E<gt>{revoke}> in the
812paragraph above.)
813
814=item text
815
816Reference to a markup removed copy of the message in scalar string format.
817
818=item msg
819
820Reference to the original message object.
821
822=back
823
824=item $plugin->whitelist_address( { options ... } )
825
826Called when a request is made to add an address to a
827persistent address list.
828
829=over 4
830
831=item address
832
833Address you wish to add.
834
835=item cli_p
836
837Indicate if the call is being made from a command line interface.
838
839=back
840
841=item $plugin->blacklist_address( { options ... } )
842
843Called when a request is made to add an address to a
844persistent address list.
845
846=over 4
847
848=item address
849
850Address you wish to add.
851
852=item cli_p
853
854Indicate if the call is being made from a command line interface.
855
856=back
857
858=item $plugin->remove_address( { options ... } )
859
860Called when a request is made to remove an address to a
861persistent address list.
862
863=over 4
864
865=item address
866
867Address you wish to remove.
868
869=item cli_p
870
871Indicate if the call is being made from a command line interface.
872
873=back
874
875=item $plugin->spamd_child_init ()
876
877Called in each new child process when it starts up under spamd.
878
879=item $plugin->log_scan_result ( { options ... } )
880
881Called when spamd has completed scanning a message. Currently,
882only spamd calls this API.
883
884=over 4
885
886=item result
887
888The C<'result: ...'> line for this scan. Format is as described
889at B<http://wiki.apache.org/spamassassin/SpamdSyslogFormat>.
890
891=back
892
893=item $plugin->spamd_child_post_connection_close ()
894
895Called when child returns from handling a connection.
896
897If there was an accept failure, the child will die and this code will
898not be called.
899
900=item $plugin->finish ()
901
902Called when the C<Mail::SpamAssassin> object is destroyed.
903
904=cut
905
906sub finish {
907 my ($self) = @_;
908 %{$self} = ();
909}
910
911=item $plugin->learner_new ()
912
913Used to support human-trained probabilistic classifiers like the BAYES_* ruleset.
914Called when a new C<Mail::SpamAssassin::Bayes> object has been created; typically
915when a new user's scan is about to start.
916
917=item $plugin->learn_message ()
918
919Train the classifier with a training message.
920
921=over 4
922
923=item isspam
924
9251 if the message is spam, 0 if it's non-spam.
926
927=item msg
928
929The message's C<Mail::SpamAssassin::Message> object.
930
931=item id
932
933An optional message-identification string, used internally to tag the message.
934If it is C<undef>, one will be generated. It should be unique to that message.
935
936=back
937
938=item $plugin->forget_message ()
939
940Tell the classifier to 'forget' its training about a specific message.
941
942=over 4
943
944=item msg
945
946The message's C<Mail::SpamAssassin::Message> object.
947
948=item id
949
950An optional message-identification string, used internally to tag the message.
951If it is C<undef>, one will be generated. It should be unique to that message.
952
953=back
954
955=item $plugin->learner_sync ()
956
957Tell the classifier to 'sync' any pending changes against the current
958user's training database. This is called by C<sa-learn --sync>.
959
960If you do not need to implement these for your classifier, create an
961implementation that just contains C<return 1>.
962
963=item $plugin->learner_expire_old_training ()
964
965Tell the classifier to perform infrequent, time-consuming cleanup of
966the current user's training database. This is called by C<sa-learn
967--force-expire>.
968
969If you do not need to implement these for your classifier, create an
970implementation that just contains C<return 1>.
971
972=item $plugin->learner_is_scan_available ()
973
974Should return 1 if it is possible to use the current user's training data for
975a message-scan operation, or 0 otherwise.
976
977=item $plugin->learner_dump_database ()
978
979Dump information about the current user's training data to C<stdout>.
980This is called by C<sa-learn --dump>.
981
982=over 4
983
984=item magic
985
986Set to 1 if "magic" name-value metadata should be dumped.
987
988=item toks
989
990Set to 1 if the database of tokens should be dumped.
991
992=item regex
993
994Either C<undef> to dump all tokens, or a value which specifies a regular expression
995subset of the tokens to dump.
996
997=back
998
999=item $plugin->learner_close ()
1000
1001Close any open databases.
1002
1003=over 4
1004
1005=item quiet
1006
1007Set to 1 if warning messages should be suppressed.
1008
1009=back
1010
1011=back
1012
1013=head1 HELPER APIS
1014
1015These methods provide an API for plugins to register themselves
1016to receive specific events, or control the callback chain behaviour.
1017
1018=over 4
1019
1020=item $plugin->register_eval_rule ($nameofevalsub)
1021
1022Plugins that implement an eval test will need to call this, so that
1023SpamAssassin calls into the object when that eval test is encountered.
1024See the B<REGISTERING EVAL RULES> section for full details.
1025
1026=cut
1027
1028
# spent 6.35ms (3.91+2.44) within Mail::SpamAssassin::Plugin::register_eval_rule which was called 192 times, avg 33µs/call: # 46 times (1.31ms+716µs) by Mail::SpamAssassin::Plugin::MIMEHeader::__ANON__[/usr/local/lib/perl5/site_perl/Mail/SpamAssassin/Plugin/MIMEHeader.pm:160] at line 157 of Mail/SpamAssassin/Plugin/MIMEHeader.pm, avg 44µs/call # 9 times (141µs+96µs) by Mail::SpamAssassin::Plugin::DNSEval::new at line 65 of Mail/SpamAssassin/Plugin/DNSEval.pm, avg 26µs/call # once (41µs+20µs) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 103 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (12µs+44µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 51 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (33µs+19µs) by Mail::SpamAssassin::Plugin::URIEval::new at line 42 of Mail/SpamAssassin/Plugin/URIEval.pm # once (28µs+18µs) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 104 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (22µs+24µs) by Mail::SpamAssassin::Plugin::Hashcash::new at line 121 of Mail/SpamAssassin/Plugin/Hashcash.pm # once (28µs+13µs) by Mail::SpamAssassin::Plugin::Razor2::new at line 77 of Mail/SpamAssassin/Plugin/Razor2.pm # once (27µs+12µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 45 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (28µs+12µs) by Mail::SpamAssassin::Plugin::Hashcash::new at line 120 of Mail/SpamAssassin/Plugin/Hashcash.pm # once (25µs+14µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 42 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (12µs+26µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 53 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (26µs+12µs) by Mail::SpamAssassin::Plugin::WhiteListSubject::new at line 64 of Mail/SpamAssassin/Plugin/WhiteListSubject.pm # once (22µs+16µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 55 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (25µs+12µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 144 of Mail/SpamAssassin/Plugin/DKIM.pm # once (26µs+11µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 45 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (24µs+13µs) by Mail::SpamAssassin::Plugin::URIDNSBL::new at line 323 of Mail/SpamAssassin/Plugin/URIDNSBL.pm # once (22µs+15µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 52 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (24µs+12µs) by Mail::SpamAssassin::Plugin::HTTPSMismatch::new at line 41 of Mail/SpamAssassin/Plugin/HTTPSMismatch.pm # once (26µs+10µs) by Mail::SpamAssassin::Plugin::URIDetail::new at line 91 of Mail/SpamAssassin/Plugin/URIDetail.pm # once (12µs+24µs) by Mail::SpamAssassin::Plugin::FreeMail::new at line 158 of Mail/SpamAssassin/Plugin/FreeMail.pm # once (19µs+17µs) by Mail::SpamAssassin::Plugin::SPF::new at line 69 of Mail/SpamAssassin/Plugin/SPF.pm # once (18µs+18µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 150 of Mail/SpamAssassin/Plugin/DKIM.pm # once (27µs+8µs) by Mail::SpamAssassin::Plugin::VBounce::new at line 46 of Mail/SpamAssassin/Plugin/VBounce.pm # once (17µs+18µs) by Mail::SpamAssassin::Plugin::BodyEval::new at line 46 of Mail/SpamAssassin/Plugin/BodyEval.pm # once (11µs+23µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 155 of Mail/SpamAssassin/Plugin/DKIM.pm # once (21µs+13µs) by Mail::SpamAssassin::Plugin::TxRep::new at line 227 of Mail/SpamAssassin/Plugin/TxRep.pm # once (24µs+10µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 70 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (28µs+6µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 68 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (20µs+13µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 65 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (23µs+10µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 43 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (13µs+20µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 46 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (16µs+18µs) by Mail::SpamAssassin::Plugin::Razor2::new at line 78 of Mail/SpamAssassin/Plugin/Razor2.pm # once (20µs+13µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 71 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (23µs+10µs) by Mail::SpamAssassin::Plugin::BodyEval::new at line 43 of Mail/SpamAssassin/Plugin/BodyEval.pm # once (22µs+10µs) by Mail::SpamAssassin::Plugin::SPF::new at line 57 of Mail/SpamAssassin/Plugin/SPF.pm # once (23µs+9µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 43 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (16µs+16µs) by Mail::SpamAssassin::Plugin::BodyEval::new at line 48 of Mail/SpamAssassin/Plugin/BodyEval.pm # once (16µs+16µs) by Mail::SpamAssassin::Plugin::SPF::new at line 71 of Mail/SpamAssassin/Plugin/SPF.pm # once (14µs+17µs) by Mail::SpamAssassin::Plugin::SPF::new at line 59 of Mail/SpamAssassin/Plugin/SPF.pm # once (15µs+16µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 51 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (24µs+7µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 49 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (15µs+16µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 146 of Mail/SpamAssassin/Plugin/DKIM.pm # once (24µs+6µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 53 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (13µs+18µs) by Mail::SpamAssassin::Plugin::Bayes::new at line 243 of Mail/SpamAssassin/Plugin/Bayes.pm # once (15µs+16µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 56 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (15µs+16µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 50 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (15µs+16µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 147 of Mail/SpamAssassin/Plugin/DKIM.pm # once (14µs+16µs) by Mail::SpamAssassin::Plugin::FreeMail::new at line 159 of Mail/SpamAssassin/Plugin/FreeMail.pm # once (14µs+16µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 46 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (15µs+16µs) by Mail::SpamAssassin::Plugin::SPF::new at line 60 of Mail/SpamAssassin/Plugin/SPF.pm # once (20µs+10µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 62 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (14µs+16µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 47 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (24µs+6µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 53 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (12µs+18µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 48 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (12µs+18µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 51 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (20µs+10µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 58 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (23µs+7µs) by Mail::SpamAssassin::Plugin::BodyEval::new at line 44 of Mail/SpamAssassin/Plugin/BodyEval.pm # once (23µs+6µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 69 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (16µs+13µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 67 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (22µs+7µs) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 109 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (13µs+17µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 47 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (12µs+17µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 46 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (12µs+17µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 50 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::URIEval::new at line 44 of Mail/SpamAssassin/Plugin/URIEval.pm # once (12µs+17µs) by Mail::SpamAssassin::Plugin::BodyEval::new at line 45 of Mail/SpamAssassin/Plugin/BodyEval.pm # once (12µs+17µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 48 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (12µs+17µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 45 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (22µs+7µs) by Mail::SpamAssassin::Plugin::VBounce::new at line 47 of Mail/SpamAssassin/Plugin/VBounce.pm # once (22µs+7µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 52 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 45 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 44 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (22µs+6µs) by Mail::SpamAssassin::Plugin::FreeMail::new at line 157 of Mail/SpamAssassin/Plugin/FreeMail.pm # once (22µs+6µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 60 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 56 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 151 of Mail/SpamAssassin/Plugin/DKIM.pm # once (22µs+7µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 54 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 49 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 53 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 51 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (13µs+15µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 44 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 48 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 49 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (22µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 72 of Mail/SpamAssassin/Plugin/SPF.pm # once (22µs+6µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 56 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (21µs+7µs) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 106 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (22µs+6µs) by Mail::SpamAssassin::Plugin::BodyEval::new at line 47 of Mail/SpamAssassin/Plugin/BodyEval.pm # once (15µs+13µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 63 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 108 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 47 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 51 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (22µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 62 of Mail/SpamAssassin/Plugin/SPF.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 48 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 52 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 54 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (12µs+16µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 57 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 58 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (21µs+7µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 159 of Mail/SpamAssassin/Plugin/DKIM.pm # once (21µs+7µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 44 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 50 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (15µs+13µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 45 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (20µs+7µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 47 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 160 of Mail/SpamAssassin/Plugin/DKIM.pm # once (12µs+15µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 48 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (15µs+12µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 43 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 46 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (21µs+6µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 66 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (20µs+7µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 54 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (20µs+7µs) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 107 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (20µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 66 of Mail/SpamAssassin/Plugin/SPF.pm # once (20µs+6µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 52 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (20µs+6µs) by Mail::SpamAssassin::Plugin::HTMLEval::new at line 46 of Mail/SpamAssassin/Plugin/HTMLEval.pm # once (20µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 68 of Mail/SpamAssassin/Plugin/SPF.pm # once (19µs+6µs) by Mail::SpamAssassin::Plugin::WLBLEval::new at line 49 of Mail/SpamAssassin/Plugin/WLBLEval.pm # once (12µs+14µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 50 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (20µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 65 of Mail/SpamAssassin/Plugin/SPF.pm # once (12µs+13µs) by Mail::SpamAssassin::Plugin::WhiteListSubject::new at line 65 of Mail/SpamAssassin/Plugin/WhiteListSubject.pm # once (13µs+12µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 145 of Mail/SpamAssassin/Plugin/DKIM.pm # once (18µs+7µs) by Mail::SpamAssassin::Plugin::SPF::new at line 63 of Mail/SpamAssassin/Plugin/SPF.pm # once (15µs+9µs) by Mail::SpamAssassin::Plugin::FreeMail::new at line 156 of Mail/SpamAssassin/Plugin/FreeMail.pm # once (12µs+12µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 64 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (12µs+12µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 53 of Mail/SpamAssassin/Plugin/RelayEval.pm # once (18µs+6µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 61 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (15µs+9µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 59 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (18µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 70 of Mail/SpamAssassin/Plugin/SPF.pm # once (13µs+10µs) by Mail::SpamAssassin::Plugin::URIEval::new at line 43 of Mail/SpamAssassin/Plugin/URIEval.pm # once (16µs+7µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 52 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (16µs+6µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 49 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (15µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 67 of Mail/SpamAssassin/Plugin/SPF.pm # once (14µs+7µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 158 of Mail/SpamAssassin/Plugin/DKIM.pm # once (13µs+7µs) by Mail::SpamAssassin::Plugin::SPF::new at line 58 of Mail/SpamAssassin/Plugin/SPF.pm # once (13µs+7µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 55 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (12µs+7µs) by Mail::SpamAssassin::Plugin::MIMEEval::new at line 54 of Mail/SpamAssassin/Plugin/MIMEEval.pm # once (12µs+7µs) by Mail::SpamAssassin::Plugin::SPF::new at line 61 of Mail/SpamAssassin/Plugin/SPF.pm # once (12µs+7µs) by Mail::SpamAssassin::Plugin::HeaderEval::new at line 50 of Mail/SpamAssassin/Plugin/HeaderEval.pm # once (12µs+7µs) by Mail::SpamAssassin::Plugin::ImageInfo::new at line 105 of Mail/SpamAssassin/Plugin/ImageInfo.pm # once (12µs+7µs) by Mail::SpamAssassin::Plugin::DKIM::new at line 154 of Mail/SpamAssassin/Plugin/DKIM.pm # once (12µs+6µs) by Mail::SpamAssassin::Plugin::SPF::new at line 64 of Mail/SpamAssassin/Plugin/SPF.pm # once (12µs+6µs) by Mail::SpamAssassin::Plugin::RelayEval::new at line 47 of Mail/SpamAssassin/Plugin/RelayEval.pm
sub register_eval_rule {
1029192450µs my ($self, $nameofsub) = @_;
103019211.0ms1922.44ms $self->{main}->{conf}->register_eval_rule ($self, $nameofsub);
# spent 2.44ms making 192 calls to Mail::SpamAssassin::Conf::register_eval_rule, avg 13µs/call
1031}
1032
1033=item $plugin->register_generated_rule_method ($nameofsub)
1034
1035In certain circumstances, plugins may find it useful to compile
1036perl functions from the ruleset, on the fly. It is important to
1037remove these once the C<Mail::SpamAssassin> object is deleted,
1038however, and this API allows this.
1039
1040Once the method C<$nameofsub> has been generated, call this API
1041with the name of the method (including full package scope).
1042This indicates that it's a temporary piece of generated code,
1043built from the SpamAssassin ruleset, and when
1044C<Mail::SpamAssassin::finish()> is called, the method will
1045be destroyed.
1046
1047This API was added in SpamAssassin 3.2.0.
1048
1049=cut
1050
1051sub register_generated_rule_method {
1052 my ($self, $nameofsub) = @_;
1053 push @Mail::SpamAssassin::PerMsgStatus::TEMPORARY_METHODS,
1054 $nameofsub;
1055}
1056
1057=item $plugin->register_method_priority($methodname, $priority)
1058
1059Indicate that the method named C<$methodname> on the current object
1060has a callback priority of C<$priority>.
1061
1062This is used by the plugin handler to determine the relative order of
1063callbacks; plugins with lower-numbered priorities are called before plugins
1064with higher-numbered priorities. Each method can have a different priority
1065value. The default value is C<0>. The ordering of callbacks to methods with
1066equal priority is undefined.
1067
1068Typically, you only need to worry about this if you need to ensure your
1069plugin's method is called before another plugin's implementation of that
1070method. It should be called from your plugin's constructor.
1071
1072This API was added in SpamAssassin 3.2.0.
1073
1074=cut
1075
1076sub register_method_priority {
1077 my ($self, $methname, $pri) = @_;
1078 $self->{method_priority}->{$methname} = $pri;
1079}
1080
1081=item $plugin->inhibit_further_callbacks()
1082
1083Tells the plugin handler to inhibit calling into other plugins in the plugin
1084chain for the current callback. Frequently used when parsing configuration
1085settings using C<parse_config()>.
1086
1087=back
1088
1089=cut
1090
1091
# spent 3.13ms within Mail::SpamAssassin::Plugin::inhibit_further_callbacks which was called 501 times, avg 6µs/call: # 501 times (3.13ms+0s) by Mail::SpamAssassin::Plugin::FreeMail::parse_config at line 234 of Mail/SpamAssassin/Plugin/FreeMail.pm, avg 6µs/call
sub inhibit_further_callbacks {
1092501836µs my ($self) = @_;
10935012.87ms $self->{_inhibit_further_callbacks} = 1;
1094}
1095
1096114µs1;
1097__END__