Transport/Qmail.pm

filter: Statementstmt 50.0% 15 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 4 / 6 Podpod 50.0% 1 / 2 totaltotal 40.8% 20 / 49 CC 5 SCAR 20.3
CC
5
Cov
38%
init
12.0
trySend
12.0
BEGIN
1.0
CRAP 7.6
« Transport/Sendmail.pm ↑ Summary Transport/Receive.pm »
1 # This code is part of Perl distribution Mail-Transport version 4.01.
2 # The POD got stripped from this file by OODoc version 3.05.
3 # For contributors see file ChangeLog.
4  
5 # This software is copyright (c) 2001-2025 by Mark Overmeer.
6  
7 # This is free software; you can redistribute it and/or modify it under
8 # the same terms as the Perl 5 programming language system itself.
9 # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
10  
11  
12 package Mail::Transport::Qmail;{
13 1 our $VERSION = '4.01';
14 }
15  
16 1 ▶use parent 'Mail::Transport::Send';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Log::Report 'mail-transport', import => [ qw/__x error fault/ ];
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 #--------------------
24  
25 sub init($)
26 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=3 SCAR=24.8
Pod undocumented
27 0 $args->{via} = 'qmail';
28 0 $self->SUPER::init($args);
29  
30 0 ▶ $self->{MTM_program} = $args->{proxy} || $self->findBinary('qmail-inject', '/var/qmail/bin') or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"MTM_program"} = $args->{"proxy"} || $self->findBinary("qmail-inject", "/var/qmail/bin") or return 0 0 0
Condition0%0/3
$args->{'proxy'} || $self->findBinary('qmail-inject', '/var/qmail/bin')
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'proxy'} || $self->findBinary('qmail-inject', '/var/qmail/bin')
$args->{'proxy'} $self->findBinary('qmail-inject', '/var/qmail/bin')
Truth table0%0/3
A || B
A= $args->{'proxy'}B= $self->findBinary('qmail-inject', '/var/qmail/bin')
ABresult
1X1
011
000
31 0 $self;
32 }
33  
34  
35 sub trySend($@)
36 0 ▶{ my ($self, $message, %args) = @_;
Subroutine trySend: not called CC=3 SCAR=24.8
Pod documented
37  
38 0 my $program = $self->{MTM_program};
39 0 my $mailer;
40 0 ▶ if(open($mailer, '|-')==0)
Branch: 1 branch
BranchTrueFalseTotal
if (open($mailer, "|-") == 0) 0 0 0
41 0 { { exec $program; }
42 0 fault __x"cannot open pipe to {program}.", program => $program;
43 }
44  
45 0 $self->putContent($message, $mailer, undisclosed => 1);
46  
47 0 ▶ $mailer->close
Branch: 1 branch
BranchTrueFalseTotal
$mailer->close or &fault(&__x("errors when closing Qmail mailer {program}", "program", $program)) 0 0 0
48 or fault __x"errors when closing Qmail mailer {program}", program => $program;
49  
50 0 1;
51 }
52  
53 1 1;
« Transport/Sendmail.pm ↑ Summary Transport/Receive.pm »