WWW/Alexa/TrafficRank.pm

filter: Statementstmt 63.3% 19 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 77.7% 7 / 9 Podpod 100% 1 / 1 totaltotal 55.1% 27 / 49 CC 5 SCAR 18.0
CC
5
Cov
50%
_prepare_wheel
12.0
_process_request
12.0
BEGIN
1.0
CRAP 6.1
« WWW/WebDevout/BrowserSupportInfo.pm ↑ Summary WWW/DoctypeGrabber.pm »
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 = '2.001002'; # 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 1 ▶sub _methods_define {
Subroutine _methods_define: called CC=1 SCAR=0.0
13 1 return ( rank => '_wheel_entry' );
14 }
15  
16 1 ▶sub rank {
Subroutine rank: called CC=1 SCAR=0.0
Pod documented
17 1 $poe_kernel->post( shift->{session_id} => rank => @_ );
18 }
19  
20 0 ▶sub _prepare_wheel {
Subroutine _prepare_wheel: not called CC=3 SCAR=24.8
21 0 my $self = shift;
22 0 ▶ $self->{timeout} ||= 30;
Condition0%0/2
$self->{"timeout"} ||= 30
l!l
00
MC/DC0%0/1
$self->{"timeout"} ||= 30
$self->{"timeout"}
Truth table0%0/2
A
A= $self->{"timeout"}
Aresult
11
00
23 $self->{obj} = WWW::Alexa::TrafficRank->new(
24 0 ▶ map { defined $self->{$_} ? ( $_ => $self->{$_} ) : () }
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{$_} ? : 0 0 0
25 qw/agent proxy timeout/
26 );
27 }
28  
29 0 ▶sub _process_request {
Subroutine _process_request: not called CC=3 SCAR=24.8
30 0 my ( $self, $in_ref ) = @_;
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
BranchTrueFalseTotal
if (not length $in_ref->{'rank'}) { } 0 0 0
elsif (not $in_ref->{'rank'} =~ /^[\d,]+$/) { } 0 0 0
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__
« WWW/WebDevout/BrowserSupportInfo.pm ↑ Summary WWW/DoctypeGrabber.pm »