Mail/Qmail/Filter/SkipQueue.pm

filter: Statementstmt 25.0% 11 / 44 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 60.0% 3 / 5 Podpod 100% 1 / 1 totaltotal 15.4% 15 / 97 CC 18 SCAR 54.7
CC
18
Cov
13%
filter
306.0
__ANON__
6.0
BEGIN
1.0
CRAP 237.1
« Mail/Qmail/Filter/CheckDeliverability.pm ↑ Summary Mail/Qmail/Filter/Base/CalloutVerify.pm »
1 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Mail::Qmail::Filter::SkipQueue;
5  
6 1 our $VERSION = '1.01';
7  
8 1 ▶use Mo qw(coerce);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 extends 'Mail::Qmail::Filter';
10  
11 0 ▶sub filter {
Subroutine filter: not called CC=17 SCAR=57.2
Pod documented
12 0 my $self = shift;
13 0 my $message = $self->message;
14  
15 0 ▶ require Qmail::Deliverable and Qmail::Deliverable->import('dot_qmail')
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Mail::Qmail::Filter::SkipQueue::dot_qmail 0 0 0
Condition0%0/6
defined &Mail::Qmail::Filter::SkipQueue::dot_qmail || require Qmail::Deliverable && 'Qmail::Deliverable'->import('dot_qmail')
l!l&&r!l&&!r
000
require Qmail::Deliverable and "Qmail::Deliverable"->import("dot_qmail")
!ll&&!rl&&r
000
MC/DC0%0/3
defined &Mail::Qmail::Filter::SkipQueue::dot_qmail || require Qmail::Deliverable && 'Qmail::Deliverable'->import('dot_qmail')
defined &Mail::Qmail::Filter::SkipQueue::dot_qmail require Qmail::Deliverable "Qmail::Deliverable"->import("dot_qmail")
Truth table0%0/4
A || B and C
A= defined &Mail::Qmail::Filter::SkipQueue::dot_qmailB= require Qmail::DeliverableC= "Qmail::Deliverable"->import("dot_qmail")
ABCresult
1XX1
0111
00X0
0100
16 unless defined &dot_qmail;
17  
18 0 my $dot_qmail;
19 0 for ( $message->to ) {
20 0 ▶ my $_dot_qmail = dot_qmail($_)
Branch: 1 branch
BranchTrueFalseTotal
my $_dot_qmail = dot_qmail($_) or return $self->debug("No .qmail file found for rcpt", $_) 0 0 0
21 or return $self->debug( 'No .qmail file found for rcpt' => $_ );
22 0 $self->debug( 'using file' => $_dot_qmail );
23 0 ▶ return $self->debug('Delivery to different .qmail files not supported')
Branch: 1 branch
BranchTrueFalseTotal
if defined $dot_qmail and $_dot_qmail ne $dot_qmail 0 0 0
Condition0%0/3
defined $dot_qmail and $_dot_qmail ne $dot_qmail
!ll&&!rl&&r
000
MC/DC0%0/2
defined $dot_qmail and $_dot_qmail ne $dot_qmail
defined $dot_qmail $_dot_qmail ne $dot_qmail
Truth table0%0/3
A and B
A= defined $dot_qmailB= $_dot_qmail ne $dot_qmail
ABresult
0X0
100
111
24 if defined $dot_qmail && $_dot_qmail ne $dot_qmail;
25 0 $dot_qmail = $_dot_qmail;
26 }
27  
28 0 ▶ open my $fh, '<', $dot_qmail
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $dot_qmail or return $self->debug("Cannot read $dot_qmail", $!) 0 0 0
29 or return $self->debug( "Cannot read $dot_qmail", $! );
30  
31 0 my @commands;
32 0 ▶ while ( defined( my $line = <$fh> ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 0 0 0
33 0 ▶ next if /^#/;
Branch: 1 branch
BranchTrueFalseTotal
if /^#/u 0 0 0
34 0 chomp $line;
35 0 ▶ if ( $line !~ /^\|/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $line =~ /^\|/u) { } 0 0 0
36 0 $self->debug( 'Delivery method not supported', $line );
37 }
38 else {
39 0 push @commands, $line;
40 }
41 }
42  
43 0 local $ENV{SENDER} = $message->from;
44 0 for (@commands) {
45 0 ▶ require Capture::Tiny and Capture::Tiny->import('capture_merged')
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Mail::Qmail::Filter::SkipQueue::capture_merged 0 0 0
Condition0%0/6
defined &Mail::Qmail::Filter::SkipQueue::capture_merged || require Capture::Tiny && 'Capture::Tiny'->import('capture_merged')
l!l&&r!l&&!r
000
require Capture::Tiny and "Capture::Tiny"->import("capture_merged")
!ll&&!rl&&r
000
MC/DC0%0/3
defined &Mail::Qmail::Filter::SkipQueue::capture_merged || require Capture::Tiny && 'Capture::Tiny'->import('capture_merged')
defined &Mail::Qmail::Filter::SkipQueue::capture_merged require Capture::Tiny "Capture::Tiny"->import("capture_merged")
Truth table0%0/4
A || B and C
A= defined &Mail::Qmail::Filter::SkipQueue::capture_mergedB= require Capture::TinyC= "Capture::Tiny"->import("capture_merged")
ABCresult
1XX1
0111
00X0
0100
46 unless defined &capture_merged;
47 my ( $output, $exitcode ) = capture_merged(
48 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
49 0 ▶ open my $fh, $_ or return $self->debug( "Cannot start $_", $! );
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, $_ or return $self->debug("Cannot start $_", $!) 0 0 0
50 0 print $fh $message->body;
51 0 close $fh;
52 0 $?;
53 }
54 0 );
55 0 $output = join '/', split /\n/, $output;
56 0 $exitcode >>= 8;
57 0 $self->debug( qq("$_" returned with exit code $exitcode) => $output );
58 0 ▶ next if $exitcode == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $exitcode == 0 0 0 0
59 0 ▶ last if $exitcode == 99;
Branch: 1 branch
BranchTrueFalseTotal
if $exitcode == 99 0 0 0
60 0 ▶ $self->reject($output) if $exitcode == 100;
Branch: 1 branch
BranchTrueFalseTotal
if $exitcode == 100 0 0 0
61 0 return;
62 }
63  
64 0 $self->debug( action => 'delivered' );
65 }
66  
67 1 1;
68  
69 __END__
« Mail/Qmail/Filter/CheckDeliverability.pm ↑ Summary Mail/Qmail/Filter/Base/CalloutVerify.pm »