Audit/Vacation.pm

filter: Statementstmt 50.0% 20 / 40 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 34.2% 24 / 70 CC 10 SCAR 41.7
CC
10
Cov
33%
vacation
90.5
BEGIN
1.0
BEGIN
1.0
CRAP 64.9
« Audit.pm ↑ Summary Audit/MAPS.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Mail::Audit::Vacation;
3 {
4 1 $Mail::Audit::Vacation::VERSION = '2.228';
5 }
6 # ABSTRACT: perform vacation autoresponding
7 1 ▶use Mail::Audit;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use vars qw($vacfile $message $subject $replyto $from);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 $vacfile = ".vacation-cache";
10 1 $message = "This user is on vacation.";
11 1 $subject = "Vacation autoresponse";
12 1 $replyto = $from = "<>";
13  
14 package Mail::Audit;
15 {
16 1 $Mail::Audit::VERSION = '2.228';
17 }
18  
19 0 ▶sub vacation {
Subroutine vacation: not called CC=10 SCAR=45.1
Pod undocumented
20 0 my $item = shift;
21 0 my $where = shift;
22 0 ▶ my $reply = $item->head->get("Reply-To")
Condition0%0/3
$item->head->get('Reply-To') || $item->head->get('From')
l!l&&r!l&&!r
000
MC/DC0%0/2
$item->head->get('Reply-To') || $item->head->get('From')
$item->head->get('Reply-To') $item->head->get('From')
Truth table0%0/3
A || B
A= $item->head->get('Reply-To')B= $item->head->get('From')
ABresult
1X1
011
000
23 || $item->head->get("From");
24 0 ▶ return if $item->head->get("Distribution") =~ /bulk/i or !$reply;
Branch: 1 branch
BranchTrueFalseTotal
if $item->head->get("Distribution") =~ /bulk/i or not $reply 0 0 0
Condition0%0/3
$item->head->get("Distribution") =~ /bulk/i or not $reply
l!l&&r!l&&!r
000
MC/DC0%0/2
$item->head->get("Distribution") =~ /bulk/i or not $reply
$item->head->get("Distribution") =~ /bulk/i not $reply
Truth table0%0/3
A or not(B)
A= $item->head->get("Distribution") =~ /bulk/iB= not $reply
ABresult
1X1
011
000
25 0 $item->_log(1, "Vacation thing from $reply");
26 0 ▶ if (open TOLD, $Mail::Audit::Vacation::vacfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (open TOLD, $Mail::Audit::Vacation::vacfile) 0 0 0
27 0 ▶ while (<TOLD>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline TOLD)) 0 0 0
28 0 ▶ if ($_ eq $reply) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ eq $reply) 0 0 0
29 0 $item->accept($where);
30 0 return 1; # Just in case.
31 }
32 }
33 }
34 0 ▶ if (open TOLD, ">>" . $Mail::Audit::Vacation::vacfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (open TOLD, '>>' . $Mail::Audit::Vacation::vacfile) 0 0 0
35 0 ▶ print TOLD $item->head->get("Reply-To")
Branch: 1 branch
BranchTrueFalseTotal
if $item->head->get("Reply-To") 0 0 0
36 if $item->head->get("Reply-To");
37 0 ▶ print TOLD $item->head->get("From")
Branch: 1 branch
BranchTrueFalseTotal
if $item->head->get("From") 0 0 0
38 if $item->head->get("From");
39 0 close TOLD;
40 1 ▶ use Mail::Mailer qw(sendmail);
Subroutine BEGIN: called CC=1 SCAR=0.0
41 0 my $out = new Mail::Mailer;
42 0 $out->open(
43 {
44 From => $Mail::Audit::Vacation::from,
45 Subject => $Mail::Audit::Vacation::subject,
46 To => $reply,
47 "Reply-To" => $Mail::Audit::Vacation::replyto
48 }
49 );
50 0 print $out $Mail::Audit::Vacation::message;
51 0 $out->close;
52 }
53 0 $item->accept($where);
54  
55 0 return 0;
56 }
57  
58 __END__
« Audit.pm ↑ Summary Audit/MAPS.pm »