Plugin/AntiSpamMailTo.pm

filter: Statementstmt 58.3% 14 / 24 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 51.4% 18 / 35 CC 3 SCAR 15.9
CC
3
Cov
50%
_make_response_message
12.0
_make_default_args
2.0
_message_into_response_event
2.0
CRAP 4.9
« Plugin/BrowserSupport.pm ↑ Summary Plugin/CSS/Minifier.pm »
1 package POE::Component::IRC::Plugin::AntiSpamMailTo;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '2.001004'; # VERSION
7  
8 1 ▶use HTML::Entities;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use base 'POE::Component::IRC::Plugin::BaseWrap';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶sub _make_default_args {
Subroutine _make_default_args: not called CC=1 SCAR=6.9
12 return (
13 0 trigger => qr/^mailto\s+(?=\S)/i,
14 response_event => 'irc_antispam_mailto',
15 max_length => 350,
16 );
17 }
18  
19 0 ▶sub _make_response_message {
Subroutine _make_response_message: not called CC=3 SCAR=24.8
20 0 my ( $self, $in_ref ) = @_;
21  
22 0 my $prefix = '';
23 0 ▶ if ( $in_ref->{type} eq 'public' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_ref->{"type"} eq "public") 0 0 0
24 0 $prefix = (split /!/, $in_ref->{who})[0] . ', ';
25 }
26  
27 0 my $val = encode_entities( $in_ref->{what}, '\\W\\w' );
28 0 ▶ if ( length $val > $self->{max_length} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $val > $self->{"max_length"}) 0 0 0
29 0 $val = substr($val, 0, $self->{max_length}) . '...';
30 }
31 0 return $prefix . $val;
32 }
33  
34 0 ▶sub _message_into_response_event { 'out'; }
Subroutine _message_into_response_event: not called CC=1 SCAR=6.9
35  
36 1 1;
37 __END__
« Plugin/BrowserSupport.pm ↑ Summary Plugin/CSS/Minifier.pm »