AutoTeX/Mail.pm

filter: Statementstmt 21.0% 8 / 38 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 33.3% 2 / 6 Podpod 100% 4 / 4 totaltotal 21.5% 14 / 65 CC 7 SCAR 31.1
CC
7
Cov
16%
send_notification
42.0
new
6.0
send_failure
2.0
CRAP 22.5
« AutoTeX.pm ↑ Summary AutoTeX/ConcatPDF.pm »
1 package TeX::AutoTeX::Mail;
2  
3 #
4 # $Id: Mail.pm,v 1.5.2.4 2011/01/27 18:42:28 thorstens Exp $
5 # $Revision: 1.5.2.4 $
6 # $Source: /cvsroot/arxivlib/arXivLib/lib/TeX/AutoTeX/Mail.pm,v $
7 #
8 # $Date: 2011/01/27 18:42:28 $
9 # $Author: thorstens $
10 #
11  
12 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 ### use warnings;
14  
15 2 our ($VERSION) = '$Revision: 1.5.2.4 $' =~ m{ \$Revision: \s+ (\S+) }x;
16  
17 2 ▶use TeX::AutoTeX::Config qw($TEX_ADMIN_ADDRESS $MAIL_FAILURES_ADDRESS $SENDMAIL);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
20 0 my $that = shift;
21 0 ▶ my $class = ref($that) || $that;
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
22 0 my $self = {id => shift};
23 0 bless $self, $class;
24 }
25  
26 0 ▶sub send_notification {
Subroutine send_notification: not called CC=6 SCAR=37.4
Pod documented
27 0 my ($self, $to, $subject, $message, $reply_to) = @_;
28  
29 0 ▶ if (!defined $to) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $to) 0 0 0
30 0 return 'send_notification called but no message sent as destination address undefined.';
31 }
32  
33 0 my $PIPEMAIL;
34 0 ▶ if (!open $PIPEMAIL, q{|-}, $SENDMAIL) {
Branch: 1 branch
BranchTrueFalseTotal
unless (open $PIPEMAIL, "|-", $TeX::AutoTeX::Mail::SENDMAIL) 0 0 0
35 0 return 'send_notification failed to open pipe to sendmail for writing.';
36 }
37  
38 0 ▶ $message ||= '[NO MESSAGE SPECIFIED IN ' . __PACKAGE__ . "]\n";
Condition0%0/2
$message ||= "[NO MESSAGE SPECIFIED IN TeX::AutoTeX::Mail]\n"
l!l
00
MC/DC0%0/1
$message ||= "[NO MESSAGE SPECIFIED IN TeX::AutoTeX::Mail]\n"
$message
Truth table0%0/2
A
A= $message
Aresult
11
00
39 0 $message =~ s/\n\./\n \./g;
40  
41 0 ▶ my $id = $self->{id} || 'NO_IDENTIFIER';
Condition0%0/2
$self->{'id'} || 'NO_IDENTIFIER'
l!l
00
MC/DC0%0/1
$self->{'id'} || 'NO_IDENTIFIER'
$self->{'id'}
Truth table0%0/2
A
A= $self->{'id'}
Aresult
11
00
42 0 print {$PIPEMAIL} <<"EOM";
43 To: $to
44 Subject: AutoTeX[$id]: $subject
45 EOM
46 0 ▶ if ($reply_to) {
Branch: 1 branch
BranchTrueFalseTotal
if ($reply_to) 0 0 0
47 0 print {$PIPEMAIL} "Reply-To: $reply_to\n";
48 }
49 0 print {$PIPEMAIL} "\n\n",
50 $message;
51 0 close $PIPEMAIL;
52 0 return;
53 }
54  
55 0 ▶sub send_failure {
Subroutine send_failure: not called CC=1 SCAR=6.9
Pod documented
56 0 my $self = shift;
57 0 my $subject = shift;
58 0 $subject = "$subject (mail_failure)";
59 0 return $self->send_notification($MAIL_FAILURES_ADDRESS, $subject, @_);
60 }
61  
62 0 ▶sub send_tex_admin {
Subroutine send_tex_admin: not called CC=1 SCAR=6.9
Pod documented
63 0 my $self = shift;
64 0 my $subject = shift;
65 0 $subject = "$subject (mail_tex_admin)";
66 0 return $self->send_notification($TEX_ADMIN_ADDRESS, $subject, @_);
67 }
68  
69 2 1;
70  
71 __END__
« AutoTeX.pm ↑ Summary AutoTeX/ConcatPDF.pm »