lib/Email/Blaster/MaillogWatcher/Postfix.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 CC 2 SCAR 12.0
CC
2
Cov
0%
watch_maillog
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1  
2 package Email::Blaster::MaillogWatcher::Postfix;
3  
4 use strict;
5 use warnings 'all';
6 use base 'Email::Blaster::MaillogWatcher';
7 use Time::HiRes 'usleep';
8  
9  
10 #==============================================================================
11 sub watch_maillog
12 {
13 my ($s, $maillog_path, $queued_as) = @_;
14
15 warn "Waiting for the message ($queued_as) to go out...\n";
16 while( 1 )
17 {
18 my $wanted = `grep $queued_as $maillog_path*`;
19 my $status;
20
21 unless( ($status) = $wanted =~ m/status\=(sent|bounced|deferred)\s+/io )
22 {
23 usleep(500000);
24 next;
25 }# end unless()
26
27 # We have sent it:
28 return lc($status) eq 'sent';
29 }# end while()
30 }# end watch_maillog()
31  
32 1;# return true:
33