Send/Qmail.pm

filter: Statementstmt 72.9% 27 / 37 Branchbran 25.0% 3 / 12 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 2 totaltotal 61.2% 38 / 62 CC 8 SCAR 19.8
CC
8
Cov
61%
send
20.0
_find_qmail
4.9
is_available
2.3
CRAP 7.3
« Send/NNTP.pm ↑ Summary Send/Sendmail.pm »
1 package Email::Send::Qmail;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 3 our $VERSION = '2.202';
5 3 $VERSION = eval $VERSION;
6  
7 3 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 local $Return::Value::NO_CLUCK = 1;
10 3 require Return::Value;
11 3 Return::Value->import;
12 }
13 3 ▶use Symbol qw(gensym);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 3 ▶use vars qw[$QMAIL];
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶$QMAIL ||= q[qmail-inject];
Condition50%1/2
$Email::Send::Qmail::QMAIL ||= "qmail-inject"
l!l
03
MC/DC0%0/1
$Email::Send::Qmail::QMAIL ||= "qmail-inject"
$Email::Send::Qmail::QMAIL
Truth table50%1/2
A
A= $Email::Send::Qmail::QMAIL
Aresult
11
00
17  
18 1 ▶sub is_available {
Subroutine is_available: called CC=2 SCAR=8.1
Pod undocumented
19 1 my $class = shift;
20  
21  
22 1 ▶ return failure "No qmail found" unless $class->_find_qmail;
Branch: 1 branch
BranchTrueFalseTotal
unless $class->_find_qmail 1 0 1
23 0 return success;
24 }
25  
26 1 ▶sub _find_qmail {
Subroutine _find_qmail: called CC=4 SCAR=15.9
27 1 my $class = shift;
28  
29 1 my $sendmail;
30  
31 1 ▶ if (-x $QMAIL) {
Branch: 1 branch
BranchTrueFalseTotal
if (-x $Email::Send::Qmail::QMAIL) 0 1 1
32 0 return $QMAIL;
33 }
34  
35 1 for my $dir (File::Spec->path) {
36 10 ▶ if ( -x "$dir/$QMAIL" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-x "$dir/$Email::Send::Qmail::QMAIL") 0 10 10
37 0 $sendmail = "$dir/$QMAIL";
38 0 last;
39 }
40 }
41 1 return $sendmail;
42 }
43  
44 0 ▶sub send {
Subroutine send: not called CC=4 SCAR=30.0
Pod undocumented
45 0 my ($class, $message, @args) = @_;
46  
47 0 my $pipe = gensym;
48  
49 0 ▶ open $pipe, "| $QMAIL @args"
Branch: 1 branch
BranchTrueFalseTotal
open $pipe, "| $Email::Send::Qmail::QMAIL @args" or return failure("couldn't open pipe to qmail") 0 0 0
50 or return failure "couldn't open pipe to qmail";
51  
52 0 ▶ print $pipe $message->as_string
Branch: 1 branch
BranchTrueFalseTotal
print $pipe $message->as_string or return failure("couldn't send message to qmail") 0 0 0
53 or return failure "couldn't send message to qmail";
54  
55 0 ▶ close $pipe
Branch: 1 branch
BranchTrueFalseTotal
close $pipe or return failure("error when closing pipe to qmail") 0 0 0
56 or return failure "error when closing pipe to qmail";
57  
58 0 return success;
59 }
60  
61 3 1;
62  
63 __END__
« Send/NNTP.pm ↑ Summary Send/Sendmail.pm »