| 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
Condition0%0/6
defined &Mail::Qmail::Filter::SkipQueue::dot_qmail || require Qmail::Deliverable && 'Qmail::Deliverable'->import('dot_qmail')
require Qmail::Deliverable and "Qmail::Deliverable"->import("dot_qmail")
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/3
defined $dot_qmail and $_dot_qmail ne $dot_qmail
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | or return $self->debug( "Cannot read $dot_qmail", $! ); | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my @commands; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | while ( defined( my $line = <$fh> ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | next if /^#/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if ( $line !~ /^\|/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/6
defined &Mail::Qmail::Filter::SkipQueue::capture_merged || require Capture::Tiny && 'Capture::Tiny'->import('capture_merged')
require Capture::Tiny and "Capture::Tiny"->import("capture_merged")
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | last if $exitcode == 99; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $self->reject($output) if $exitcode == 100; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | $self->debug( action => 'delivered' ); | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | __END__ | ||||||||||||||||||||||||||||||||||||||||||