Send/Qmail.pm

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