blib/lib/Egg/View/Mail/Plugin/EmbAgent.pm

filter: Statementstmt 34.7% 8 / 23 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 25.0% 10 / 40 CC 6 SCAR 34.6
CC
6
Cov
24%
__get_mailbody
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 31.8
« blib/lib/Egg/View/Mail.pm ↑ Summary blib/lib/Egg/View/Mail/Base.pm »
1 package Egg::View::Mail::Plugin::EmbAgent;
2 #
3 # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4 #
5 # $Id: EmbAgent.pm 332 2008-04-19 17:03:10Z lushe $
6 #
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = '0.06';
11  
12 0 ▶sub __get_mailbody {
Subroutine __get_mailbody: not called CC=6 SCAR=37.4
13 0 my($self, $data)= @_;
14 return $self->next::method($data)
15 0 ▶ if ($data->{no_embagent} or ! $data->{body});
Branch: 1 branch
BranchTrueFalseTotal
if $data->{"no_embagent"} or not $data->{"body"} 0 0 0
Condition0%0/3
$data->{"no_embagent"} or not $data->{"body"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$data->{"no_embagent"} or not $data->{"body"}
$data->{"no_embagent"} not $data->{"body"}
Truth table0%0/3
A or not(B)
A= $data->{"no_embagent"}B= not $data->{"body"}
ABresult
1X1
011
000
16 0 my $req = $self->e->request;
17 0 my $ipaddr= $req->address;
18 my $regex = $data->{no_embagent_ip_regex}
19 0 ▶ || qr{^(?:192\.168\.|127\.0\.0\.1)};
Condition0%0/2
$data->{'no_embagent_ip_regex'} || qr/^(?:192\.168\.|127\.0\.0\.1)/
l!l
00
MC/DC0%0/1
$data->{'no_embagent_ip_regex'} || qr/^(?:192\.168\.|127\.0\.0\.1)/
$data->{'no_embagent_ip_regex'}
Truth table0%0/2
A
A= $data->{'no_embagent_ip_regex'}
Aresult
11
00
20 0 ▶ return $self->next::method($data) if $ipaddr=~m{$regex};
Branch: 1 branch
BranchTrueFalseTotal
if $ipaddr =~ /$regex/ 0 0 0
21 0 my $body= $data->{body}= $self->__init_mailbody($data);
22 0 $$body.= <<END_AGENT;
23  
24  
25 ----------------------------------------------------------------------
26 END_AGENT
27 0 ▶ if ($data->{embagent_remote_host}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"embagent_remote_host"}) 0 0 0
28 0 $$body.= <<END_AGENT;
29 0 REMOTE_HOST : @{[ $req->remote_host ]}
30 END_AGENT
31 }
32 0 $$body.= <<END_AGENT;
33 0 REMOTE_ADDR : @{[ $req->address ]}
34 0 USER_AGENT : @{[ $req->agent ]}
35 ----------------------------------------------------------------------
36 END_AGENT
37 0 $self->next::method($data);
38 }
39  
40 2 1;
41  
42 __END__
« blib/lib/Egg/View/Mail.pm ↑ Summary blib/lib/Egg/View/Mail/Base.pm »