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 unless( ($status) = $wanted =~ m/\sstatus\=(.*?)\s/i )
21 {
22 usleep(500000);
23 next;
24 }# end until()
25
26 # We have sent it:
27 return lc($wanted) eq 'sent';
28 }# end while()
29 }# end watch_maillog()
30  
31 1;# return true:
32