/usr/share/perl5/Mail/ListDetector.pm is in libmail-listdetector-perl 1.03+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | package Mail::ListDetector;
use strict;
use Carp qw(carp croak);
require Exporter;
use AutoLoader qw(AUTOLOAD);
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION);
use vars qw(@DETECTORS);
@ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use Mail::ListDetector ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
%EXPORT_TAGS = ( 'all' => [ qw(
) ] );
@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
@EXPORT = qw(
);
$VERSION = '1.03';
my @default_detectors = qw(Mailman Ezmlm Smartlist Listar Ecartis Yahoogroups CommuniGatePro GoogleGroups Listbox AutoShare RFC2919 Fml ListSTAR RFC2369 CommuniGate LetterRip Lyris Onelist Majordomo Listserv);
foreach (@default_detectors) {
s/^/Mail::ListDetector::Detector::/;
Mail::ListDetector->register_plugin($_);
}
# package subs
sub new {
my $proto = shift;
my $message = shift;
carp("Mail::ListDetector:: no message supplied\n") unless defined($message);
my $class = ref($proto) || $proto;
# get message
# for all detectors, instantiate and pass until one returns
# an object
my $list;
foreach my $detector_name (@DETECTORS) {
my $detector;
$detector = eval "new $detector_name";
if ($@) {
die $@;
}
if ($list = $detector->match($message)) {
return $list;
}
}
return undef;
}
# load a plugin module
sub register_plugin {
my $self = shift;
my $plugin_name = shift;
eval "require $plugin_name; ${plugin_name}->import;";
croak("register_plugin couldn't load $plugin_name: $@") if $@;
push @DETECTORS, $plugin_name;
}
1;
__END__
=head1 NAME
Mail::ListDetector - Perl extension for detecting mailing list messages
=head1 SYNOPSIS
use Mail::ListDetector;
=head1 DESCRIPTION
This module analyzes mail objects in any of the classes handled by
L<Email::Abstract>. It returns a Mail::ListDetector::List object
representing the mailing list.
The RFC2369 mailing list detector is also capable of matching some
Mailman and Ezmlm messages. It is deliberately checked last to allow
the more specific Mailman and Ezmlm parsing to happen first, and more
accurately identify the type of mailing list involved.
=head1 METHODS
=head2 new
This method is the core of the module. Pass it a mail object, it will
either return a Mail::ListDetector::List object that describes the
mailing list that the message was posted to, or C<undef> if it appears
not to have been a mailing list post.
=head2 register_plugin($plugin_name)
Registers a new plugin module that might recognise lists. Should
be a subclass of Mail::ListDetector::Detector::Base, and provide
the same interface as the other detector modules.
You can eval arbitrary perl code with this, so don't do that if that's
not what you want.
=head1 EMAILS USED
This module includes a number of sample emails from various mailing
lists. In all cases, mails are used with permission of the author, and
must not be distributed separately from this archive. If you believe
I may have accidentally used your email or content without permission,
contact me, and if this turns out to be the case I will immediately remove
it from the latest version of the archive.
=head1 BUGS
=over 4
=item *
A lot of the code applies fairly simple regular expressions to email
address to extract information. This may fall over for really weird
email addresses, but I'm hoping no-one will use those for names of
mailing lists.
=item *
The majordomo and smartlist recognisers don't have much to go on,
and therefore are probably not as reliable as the other detectors.
This is liable to be hard to fix.
=item *
Forwarding messages (for example using procmail) can sometimes break
the C<Sender: > header information needed to recognise some list
types.
=back
=head1 AUTHORS
=over 4
=item *
Michael Stevens - michael@etla.org.
=item *
Andy Turner - turner@mikomi.org.
=item *
Adam Lazur - adam@lazur.org.
=item *
Peter Oliver - p.d.oliver@mavit.freeserve.co.uk
=item *
Matthew Walker - matthew@walker.wattle.id.au
=item *
Tatsuhiko Miyagawa - miyagawa@bulknews.net
=item *
johnnnnnn - john@phaedrusdeinus.org
=item *
Mik Firestone - mik@racerx.homedns.org
=item *
Simon Cozens - simon@simon-cozens.org
=back
=head1 SEE ALSO
perl(1). The Mail::Audit::List module, which is a convenient way of using
Mail::Audit and Mail::ListDetector together.
=cut
|