| 1 | package POE::Component::WWW::Alexa::TrafficRank; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 2 | our $VERSION = '1.001004'; # VERSION | |||||||||||||
| 7 | |||||||||||||||
| 8 | 2 | ▶ | use POE; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | 2 | ▶ | use base 'POE::Component::NonBlockingWrapper::Base'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 2 | ▶ | use WWW::Alexa::TrafficRank; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | |||||||||||||||
| 12 | sub _methods_define { | ||||||||||||||
| 13 | 1 | ▶ | return ( rank => '_wheel_entry' ); | ||||||||||||
|
Subroutine
_methods_define: called CC=1 SCAR=0.0
| |||||||||||||||
| 14 | } | ||||||||||||||
| 15 | |||||||||||||||
| 16 | sub rank { | ||||||||||||||
| 17 | 1 | ▶ | $poe_kernel->post( shift->{session_id} => rank => @_ ); | ||||||||||||
|
Subroutine
rank: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 18 | } | ||||||||||||||
| 19 | |||||||||||||||
| 20 | sub _prepare_wheel { | ||||||||||||||
| 21 | 0 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
_prepare_wheel: not called CC=3 SCAR=24.8
| |||||||||||||||
| 22 | 0 | ▶ | $self->{timeout} ||= 30; | ||||||||||||
|
Condition0%0/2
$self->{"timeout"} ||= 30
MC/DC0%0/1
$self->{"timeout"} ||= 30
$self->{"timeout"}
Truth table0%0/2
A
A= $self->{"timeout"}
| |||||||||||||||
| 23 | $self->{obj} = WWW::Alexa::TrafficRank->new( | ||||||||||||||
| 24 | 0 | ▶ | map { defined $self->{$_} ? ( $_ => $self->{$_} ) : () } | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 25 | qw/agent proxy timeout/ | ||||||||||||||
| 26 | ); | ||||||||||||||
| 27 | } | ||||||||||||||
| 28 | |||||||||||||||
| 29 | sub _process_request { | ||||||||||||||
| 30 | 0 | ▶ | my ( $self, $in_ref ) = @_; | ||||||||||||
|
Subroutine
_process_request: not called CC=3 SCAR=24.8
| |||||||||||||||
| 31 | 0 | $in_ref->{uri} =~ s{^(?:ht|f)tps?://|/$}{}gi; | |||||||||||||
| 32 | 0 | $in_ref->{rank} = $self->{obj}->get( $in_ref->{uri} ); | |||||||||||||
| 33 | 0 | ▶ | if ( not length $in_ref->{rank} ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 34 | 0 | $in_ref->{error} = 'No result'; | |||||||||||||
| 35 | 0 | delete $in_ref->{rank}; | |||||||||||||
| 36 | } | ||||||||||||||
| 37 | elsif ( $in_ref->{rank} !~ /^[\d,]+$/ ) { | ||||||||||||||
| 38 | 0 | $in_ref->{error} = delete $in_ref->{rank}; | |||||||||||||
| 39 | } | ||||||||||||||
| 40 | } | ||||||||||||||
| 41 | |||||||||||||||
| 42 | 2 | 1; | |||||||||||||
| 43 | __END__ | ||||||||||||||