AnyEvent::Postfix::Logs - Event based parsin of Postfix log files
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; ...
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.
Creates a new instance of a AnyEvent::Postfix::Logs module
AnyEvent::Postfix::Logs
Valid sources are perl file handles or names of log files
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 like from (string), to (array of strings), time (string), size (integer), delay (decimal point), and msgid (string).
$mail
from
to
time
size
delay
msgid
Reference to a handler called when all sources are depleted. It will be invoked as
$on_finish->()
Reference to a handler called when an error occurs. It will be invoked as
$on_error->($message)
Default is to croak
Add a list of additional sources
Peter Makholm, <peter at makholm.net>
<peter at makholm.net>
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.
bug-anyevent-postfix-logs at rt.cpan.org
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
http://annocpan.org/dist/AnyEvent-Postfix-Logs
CPAN Ratings
http://cpanratings.perl.org/d/AnyEvent-Postfix-Logs
Search CPAN
http://search.cpan.org/dist/AnyEvent-Postfix-Logs/
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.
To install AnyEvent::Postfix::Logs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Postfix::Logs
CPAN shell
perl -MCPAN -e shell install AnyEvent::Postfix::Logs
For more information on module installation, please visit the detailed CPAN module installation guide.