| 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
Condition0%0/3
$data->{"no_embagent"} or not $data->{"body"}
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"}
| |||||||||||||||||||||||||||||
| 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)/
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'}
| |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | return $self->next::method($data) if $ipaddr=~m{$regex}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||