Plugin/BrowserSupport.pm

filter: Statementstmt 41.1% 14 / 34 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod n/a totaltotal 35.2% 18 / 51 CC 5 SCAR 16.5
CC
5
Cov
33%
_make_response_message
12.0
_make_poco
6.0
_make_response_event
6.0
CRAP 5.2
« Plugin/Validator/HTML.pm ↑ Summary Plugin/AntiSpamMailTo.pm »
1 package POE::Component::IRC::Plugin::BrowserSupport;
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 POE::Component::WWW::WebDevout::BrowserSupportInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use base 'POE::Component::IRC::Plugin::BasePoCoWrap';
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 response_event => 'irc_webdevout_support',
14 trigger => qr/^support\s+(?=\S)/i,
15 );
16 }
17  
18 0 ▶sub _make_poco {
Subroutine _make_poco: not called CC=2 SCAR=17.9
19 0 my $self = shift;
20 return POE::Component::WWW::WebDevout::BrowserSupportInfo->spawn(
21 debug => $self->{debug},
22 0 ▶ exists $self->{obj_args} ? ( obj_args => $self->{obj_args} ) : (),
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'obj_args'} ? : 0 0 0
23 );
24 }
25  
26 0 ▶sub _make_response_message {
Subroutine _make_response_message: not called CC=3 SCAR=24.8
27 0 my $self = shift;
28 0 my $in_ref = shift;
29 0 my $what = substr $in_ref->{what}, 0, 10;
30 0 ▶ if ( exists $in_ref->{error} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $in_ref->{'error'}) { } 0 0 0
31 0 return [ "($what) Error: $in_ref->{error}" ];
32 }
33 else {
34 my $results = join ' | ',
35 0 map { "$_: ${\(defined $in_ref->{results}{$_}
36 0 ▶ ? $in_ref->{results}{$_} : '')}"
Branch: 1 branch
BranchTrueFalseTotal
defined $in_ref->{'results'}{$_} ? : 0 0 0
37 0 } sort keys %{ $in_ref->{results} };
38  
39 0 return [ "($what) $in_ref->{uri_info} $results" ];
40 };
41 }
42  
43 0 ▶sub _make_response_event {
Subroutine _make_response_event: not called CC=2 SCAR=17.9
44 0 my $self = shift;
45 0 my $in_ref = shift;
46  
47 return {
48 uri_info => $in_ref->{uri_info},
49 what => $in_ref->{what},
50 ( exists $in_ref->{error}
51 ? ( error => $in_ref->{error} )
52 : ( results => $in_ref->{results} )
53 ),
54 0 ▶ map { $_ => $in_ref->{"_$_"} }
Branch: 1 branch
BranchTrueFalseTotal
exists $in_ref->{'error'} ? : 0 0 0
55 qw( who channel message type ),
56 }
57 }
58  
59 0 ▶sub _make_poco_call {
Subroutine _make_poco_call: not called CC=1 SCAR=6.9
60 0 my $self = shift;
61 0 my $data_ref = shift;
62  
63 $self->{poco}->fetch( {
64 event => '_poco_done',
65 what => delete $data_ref->{what},
66 0 map +( "_$_" => $data_ref->{$_} ),
67 keys %$data_ref,
68 }
69 );
70 }
71  
72 1 1;
73 __END__
« Plugin/Validator/HTML.pm ↑ Summary Plugin/AntiSpamMailTo.pm »