| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mail::ListDetector; |
|
2
|
|
|
|
|
|
|
|
|
3
|
39
|
|
|
39
|
|
2272773
|
use strict; |
|
|
39
|
|
|
|
|
103
|
|
|
|
39
|
|
|
|
|
1691
|
|
|
4
|
39
|
|
|
39
|
|
216
|
use warnings; |
|
|
39
|
|
|
|
|
83
|
|
|
|
39
|
|
|
|
|
1516
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
39
|
|
|
39
|
|
219
|
use Carp qw(carp croak); |
|
|
39
|
|
|
|
|
76
|
|
|
|
39
|
|
|
|
|
3232
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
|
9
|
39
|
|
|
39
|
|
43045
|
use AutoLoader qw(AUTOLOAD); |
|
|
39
|
|
|
|
|
71679
|
|
|
|
39
|
|
|
|
|
237
|
|
|
10
|
39
|
|
|
39
|
|
1750
|
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION); |
|
|
39
|
|
|
|
|
82
|
|
|
|
39
|
|
|
|
|
4089
|
|
|
11
|
39
|
|
|
39
|
|
211
|
use vars qw(@DETECTORS); |
|
|
39
|
|
|
|
|
77
|
|
|
|
39
|
|
|
|
|
17008
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
|
16
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
|
17
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# This allows declaration use Mail::ListDetector ':all'; |
|
20
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
|
21
|
|
|
|
|
|
|
# will save memory. |
|
22
|
|
|
|
|
|
|
%EXPORT_TAGS = ( 'all' => [ qw( |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
) ] ); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
@EXPORT = qw( |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$VERSION = '1.04'; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my @default_detectors = qw(Mailman Ezmlm Smartlist Listar Ecartis Yahoogroups CommuniGatePro GoogleGroups Listbox AutoShare RFC2919 Fml ListSTAR RFC2369 CommuniGate LetterRip Lyris Onelist Majordomo Listserv); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
foreach (@default_detectors) { |
|
37
|
|
|
|
|
|
|
s/^/Mail::ListDetector::Detector::/; |
|
38
|
|
|
|
|
|
|
Mail::ListDetector->register_plugin($_); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# package subs |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub new { |
|
44
|
46
|
|
|
46
|
1
|
210174
|
my $proto = shift; |
|
45
|
46
|
|
|
|
|
129
|
my $message = shift; |
|
46
|
46
|
50
|
|
|
|
320
|
carp("Mail::ListDetector:: no message supplied\n") unless defined($message); |
|
47
|
46
|
|
33
|
|
|
475
|
my $class = ref($proto) || $proto; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# get message |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# for all detectors, instantiate and pass until one returns |
|
52
|
|
|
|
|
|
|
# an object |
|
53
|
46
|
|
|
|
|
101
|
my $list; |
|
54
|
46
|
|
|
|
|
163
|
foreach my $detector_name (@DETECTORS) { |
|
55
|
557
|
|
|
|
|
2483
|
my $detector; |
|
56
|
557
|
|
|
|
|
38613
|
$detector = eval "new $detector_name"; |
|
57
|
557
|
50
|
|
|
|
1887
|
if ($@) { |
|
58
|
0
|
|
|
|
|
0
|
die $@; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
557
|
100
|
|
|
|
3108
|
if ($list = $detector->match($message)) { |
|
61
|
44
|
|
|
|
|
636
|
return $list; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
12
|
return undef; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# load a plugin module |
|
69
|
|
|
|
|
|
|
sub register_plugin { |
|
70
|
780
|
|
|
780
|
1
|
1294
|
my $self = shift; |
|
71
|
780
|
|
|
|
|
1274
|
my $plugin_name = shift; |
|
72
|
|
|
|
|
|
|
|
|
73
|
780
|
|
|
|
|
55473
|
eval "require $plugin_name; ${plugin_name}->import;"; |
|
74
|
780
|
50
|
|
|
|
3608
|
croak("register_plugin couldn't load $plugin_name: $@") if $@; |
|
75
|
780
|
|
|
|
|
3045
|
push @DETECTORS, $plugin_name; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
|
79
|
|
|
|
|
|
|
__END__ |