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