| 1 | package POE::Component::IRC::Plugin::WWW::HTMLTagAttributeCounter; | ||||||||||||||||||||||||||||
| 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 base 'POE::Component::IRC::Plugin::BasePoCoWrap'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use POE::Component::WWW::HTMLTagAttributeCounter; | ||||||||||||||||||||||||||
|
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_html_counter', | |||||||||||||||||||||||||||
| 14 | trigger => qr/^count\s+(?=\S+\s+\S+\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::HTMLTagAttributeCounter->spawn( | ||||||||||||||||||||||||||||
| 21 | $self->{ua} ? $self->{ua} : () | ||||||||||||||||||||||||||||
| 22 | 0 | ▶ | ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub _make_response_message { | ||||||||||||||||||||||||||
|
Subroutine
_make_response_message: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 26 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 27 | 0 | my $in_ref = shift; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | my $prefix = ''; | |||||||||||||||||||||||||||
| 30 | 0 | ▶ | if ( $in_ref->{_type} eq 'public' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 0 | $prefix = (split /!/, $in_ref->{_who})[0] . ', '; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ( ref $in_ref->{where} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | return $prefix . 'invalid arguments. Usage: [attr|tag] http://example.com/ div span a'; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | return "$prefix$in_ref->{error}" | ||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if $in_ref->{error}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | my $what = $in_ref->{type} eq 'attr' ? 'attributes' : 'tags'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | return "${prefix}I counted $in_ref->{result_readable} $what"; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub _message_into_response_event { 'out' } | ||||||||||||||||||||||||||
|
Subroutine
_message_into_response_event: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub _make_poco_call { | ||||||||||||||||||||||||||
|
Subroutine
_make_poco_call: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 49 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 50 | 0 | my $data_ref = shift; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | my ( $type, $where, @what ) = split ' ', $data_ref->{what}; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $type = 'tag' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq "attr" or $type eq "tag"
MC/DC0%0/2
$type eq "attr" or $type eq "tag"
$type eq "attr"
$type eq "tag"
Truth table0%0/3
A or B
A= $type eq "attr"B= $type eq "tag"
| |||||||||||||||||||||||||||||
| 55 | unless $type eq 'attr' | ||||||||||||||||||||||||||||
| 56 | or $type eq 'tag'; | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $where = \'ERROR' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | unless @what; | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | $self->{poco}->count( { | ||||||||||||||||||||||||||||
| 62 | event => '_poco_done', | ||||||||||||||||||||||||||||
| 63 | where => $where, | ||||||||||||||||||||||||||||
| 64 | type => $type, | ||||||||||||||||||||||||||||
| 65 | what => \@what, | ||||||||||||||||||||||||||||
| 66 | 0 | map +( "_$_" => $data_ref->{$_} ), | |||||||||||||||||||||||||||
| 67 | keys %$data_ref, | ||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 1 | 1; | |||||||||||||||||||||||||||
| 73 | __END__ | ||||||||||||||||||||||||||||