| 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"
MC/DC0%0/1
$Email::Send::Qmail::QMAIL ||= "qmail-inject"
$Email::Send::Qmail::QMAIL
Truth table50%1/2
A
A= $Email::Send::Qmail::QMAIL
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 30 | 0 | return $QMAIL; | |||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | 1 | for my $dir (File::Spec->path) { | |||||||||||
| 34 | 9 | ▶ | if ( -x "$dir/$QMAIL" ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 48 | or return failure "couldn't open pipe to qmail"; | ||||||||||||
| 49 | |||||||||||||
| 50 | 0 | ▶ | print $pipe $message->as_string | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 51 | or return failure "couldn't send message to qmail"; | ||||||||||||
| 52 | |||||||||||||
| 53 | 0 | ▶ | close $pipe | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 54 | or return failure "error when closing pipe to qmail"; | ||||||||||||
| 55 | |||||||||||||
| 56 | 0 | return success; | |||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | 4 | 1; | |||||||||||
| 60 | |||||||||||||
| 61 | __END__ | ||||||||||||