| 1 | package POE::Component::IRC::Plugin::WWW::Alexa::TrafficRank; | ||||||||||||
| 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::Alexa::TrafficRank; | ||||||||||
|
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_alexa_traffic_rank', | |||||||||||
| 14 | trigger => qr/^traffic\s+rank\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::Alexa::TrafficRank->spawn( | ||||||||||||
| 21 | debug => $self->{debug}, | ||||||||||||
| 22 | 0 | ▶ | %{ $self->{poco_args} || {} }, | ||||||||||
|
Condition0%0/2
$self->{'poco_args'} || {}
MC/DC0%0/1
$self->{'poco_args'} || {}
$self->{'poco_args'}
Truth table0%0/2
A
A= $self->{'poco_args'}
| |||||||||||||
| 23 | ); | ||||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | 0 | ▶ | sub _make_response_message { | ||||||||||
|
Subroutine
_make_response_message: not called CC=2 SCAR=17.9
| |||||||||||||
| 27 | 0 | my $self = shift; | |||||||||||
| 28 | 0 | my $in_ref = shift; | |||||||||||
| 29 | 0 | my ( $nick ) = split /!/, $in_ref->{_who}; | |||||||||||
| 30 | 0 | ▶ | if ( defined $in_ref->{error} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | 0 | return [ "$nick, Error: $in_ref->{error}" ]; | |||||||||||
| 32 | } | ||||||||||||
| 33 | else { | ||||||||||||
| 34 | 0 | return [ "$nick, traffic rank for $in_ref->{uri} is $in_ref->{rank}" ]; | |||||||||||
| 35 | } | ||||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 0 | ▶ | sub _make_response_event { | ||||||||||
|
Subroutine
_make_response_event: not called CC=2 SCAR=17.9
| |||||||||||||
| 39 | 0 | my $self = shift; | |||||||||||
| 40 | 0 | my $in_ref = shift; | |||||||||||
| 41 | |||||||||||||
| 42 | return { | ||||||||||||
| 43 | ( exists $in_ref->{error} | ||||||||||||
| 44 | ? ( error => $in_ref->{error} ) | ||||||||||||
| 45 | : ( rank => $in_ref->{rank} ) | ||||||||||||
| 46 | ), | ||||||||||||
| 47 | |||||||||||||
| 48 | 0 | ▶ | map { $_ => $in_ref->{"_$_"} } | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 49 | qw( who channel message type what), | ||||||||||||
| 50 | } | ||||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | 0 | ▶ | sub _make_poco_call { | ||||||||||
|
Subroutine
_make_poco_call: not called CC=1 SCAR=6.9
| |||||||||||||
| 54 | 0 | my $self = shift; | |||||||||||
| 55 | 0 | my $data_ref = shift; | |||||||||||
| 56 | |||||||||||||
| 57 | $self->{poco}->rank( { | ||||||||||||
| 58 | event => '_poco_done', | ||||||||||||
| 59 | uri => $data_ref->{what}, | ||||||||||||
| 60 | 0 | map +( "_$_" => $data_ref->{$_} ), | |||||||||||
| 61 | keys %$data_ref, | ||||||||||||
| 62 | } | ||||||||||||
| 63 | ); | ||||||||||||
| 64 | } | ||||||||||||
| 65 | |||||||||||||
| 66 | 1 | 1; | |||||||||||
| 67 | __END__ | ||||||||||||