Take me over?
NAME
AnyEvent::Postfix::Logs - Event based parsin of Postfix log files
SYNOPSIS
use AnyEvent::Postfix::Logs;
my $cv = AnyEvent->condvar;
AnyEvent::Postfix::Logs->new(
sources => [ \*STDIN ],
on_mail => sub { say "Mail from $_[0]->{from} to ", join(", ", @{ $_[0]->{to} } ) },
on_finish => sub { say "No more mail"; $cv->send() },
on_error => sub { croak $_[0] },
);
# do some more stuff
$cv->recv;
...
DESCRIPTION
This module implement parsing of postfix log files from multiple sources. Each time a mail is removed from postfix' queue a callback is invoked with collected information about the mail.
Warning: This module is developen on an need to do basis for ad hoc-problems. Do not expect it to be a complete implementation, but if you need adtional features pleaes submit a bug.
METHODS
new
Creates a new instance of a AnyEvent::Postfix::Logs
module
PARAMETERS
- sources (array of sources)
-
Valid sources are perl file handles or names of log files
- on_mail (callback)
-
Reference to a handler to called for each mail fully completed by postfix. It vill be invoked as
$on_mail->($mail)
where
$mail
is a hashref with keys likefrom
(string),to
(array of strings),time
(string),size
(integer),delay
(decimal point), andmsgid
(string). - on_finish (callback)
-
Reference to a handler called when all sources are depleted. It will be invoked as
$on_finish->()
- on_error (callback)
-
Reference to a handler called when an error occurs. It will be invoked as
$on_error->($message)
Default is to croak
add_source
Add a list of additional sources
AUTHOR
Peter Makholm, <peter at makholm.net>
BUGS
Please report any bugs or feature requests to bug-anyevent-postfix-logs at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-Postfix-Logs. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc AnyEvent::Postfix::Logs
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-Postfix-Logs
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2009 Peter Makholm.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.