Lire::Email - parse and tidy objects commonly found in email logfiles
use Lire::Email;
my $parser = new Lire::Email();
my $log = $parser->parser( $line );
sanitize('emailadress', $logfrom, $curfrom);$tos = sanitize_tos($log->{'to'})($user, $domain) = splitemailadress($address);($stat, $xstat) = splitstat($status);
Lire::Email supplies an object oriented interface to store email logfile lines, similar to the one supplied by Lire::Syslog: it ISA Lire::Syslog. Furthermore, it supplies routines to manipulate email addresses and status messages, as found in email logfiles. All functions will die on error.
sanitize sanitize takes three arguments: sanitize(what, it, sane). what is one of 'emailaddress', 'relay', 'relayhost', 'relayip'. 'size', 'stat', 'msgid', 'delay'. it is the current value, in sane the "sanitized" value gets written. E.g. if what is emailadddress and it is 'Joe User <[email protected].>', sane gets assigned '[email protected]'.
sanitize_tos sanitize_tos takes a comma separated list of email addresses as argument. It returns an array of sanitized email addresses.
splitemailadress splitemailadress takes a sanitized email address as argument. It returns an array, which contains the userpart and the domainpart as elements.
splitstat splitstat takes a sanitized stat, like 'sent_(baa28063_message_accepted_for_delivery)' or 'sent_(ok)' or 'sent_(whew!_done!_was_it_as_good_for_you_as_it_was_for_me?)' or 'queued' as argument. It splits this in the first word and the rest: It returns an array like ('sent', '(ok)').
splitrelay splitrelay splits host.example.nl._[100.0.0.45] in host.example.nl. and [100.0.0.45] and splits foo.com[209.54.94.99] in foo.com and [209.54.94.99]. Lire::Syslog(3pm) $Id: Email.pm,v 1.34 2002/02/02 11:25:41 vanbaal Exp $ Copyright (C) 2000-2001 Stichting LogReport Foundation [email protected] This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. Joost van Baal <[email protected]>, based on an idea by Joost Kooij <[email protected]>