| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Email::Send::Qmail; |
|
2
|
2
|
|
|
2
|
|
956
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
75
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use File::Spec (); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
101
|
|
|
5
|
|
|
|
|
|
|
BEGIN { |
|
6
|
2
|
|
|
2
|
|
3
|
local $Return::Value::NO_CLUCK = 1; |
|
7
|
2
|
|
|
|
|
22
|
require Return::Value; |
|
8
|
2
|
|
|
|
|
109
|
Return::Value->import; |
|
9
|
|
|
|
|
|
|
} |
|
10
|
2
|
|
|
2
|
|
437
|
use Symbol qw(gensym); |
|
|
2
|
|
|
|
|
758
|
|
|
|
2
|
|
|
|
|
96
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
7
|
use vars qw[$QMAIL $VERSION]; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
453
|
|
|
13
|
|
|
|
|
|
|
$QMAIL ||= q[qmail-inject]; |
|
14
|
|
|
|
|
|
|
$VERSION = '2.200'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub is_available { |
|
17
|
1
|
|
|
1
|
0
|
1
|
my $class = shift; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
3
|
return failure "No qmail found" unless $class->_find_qmail; |
|
21
|
0
|
|
|
|
|
0
|
return success; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _find_qmail { |
|
25
|
1
|
|
|
1
|
|
1
|
my $class = shift; |
|
26
|
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
1
|
my $sendmail; |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
50
|
|
|
|
8
|
if (-x $QMAIL) { |
|
30
|
0
|
|
|
|
|
0
|
return $QMAIL; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
20
|
for my $dir (File::Spec->path) { |
|
34
|
7
|
50
|
|
|
|
54
|
if ( -x "$dir/$QMAIL" ) { |
|
35
|
0
|
|
|
|
|
0
|
$sendmail = "$dir/$QMAIL"; |
|
36
|
0
|
|
|
|
|
0
|
last; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
1
|
|
|
|
|
6
|
return $sendmail; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub send { |
|
43
|
0
|
|
|
0
|
0
|
|
my ($class, $message, @args) = @_; |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $pipe = gensym; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
open $pipe, "| $QMAIL @args" |
|
48
|
|
|
|
|
|
|
or return failure "couldn't open pipe to qmail"; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
print $pipe $message->as_string |
|
51
|
|
|
|
|
|
|
or return failure "couldn't send message to qmail"; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
close $pipe |
|
54
|
|
|
|
|
|
|
or return failure "error when closing pipe to qmail"; |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return success; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |