| 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.001003'; # 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 | sub _make_default_args { | ||||||||||
| 12 | return ( | ||||||||||
| 13 | 0 | ▶ | response_event => 'irc_alexa_traffic_rank', | ||||||||
|
Subroutine
_make_default_args: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | trigger => qr/^traffic\s+rank\s+(?=\S)/i, | ||||||||||
| 15 | ); | ||||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub _make_poco { | ||||||||||
| 19 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_make_poco: not called CC=2 SCAR=17.9
| |||||||||||
| 20 | return POE::Component::WWW::Alexa::TrafficRank->spawn( | ||||||||||
| 21 | debug => $self->{debug}, | ||||||||||
| 22 | 0 | ▶ | %{ $self->{poco_args} || {} }, | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | ); | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | sub _make_response_message { | ||||||||||
| 27 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_make_response_message: not called CC=2 SCAR=17.9
| |||||||||||
| 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 | sub _make_response_event { | ||||||||||
| 39 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_make_response_event: not called CC=2 SCAR=17.9
| |||||||||||
| 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 | sub _make_poco_call { | ||||||||||
| 54 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_make_poco_call: not called CC=1 SCAR=6.9
| |||||||||||
| 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__ | ||||||||||