blib/lib/POE/Component/WWW/OhNoRobotCom/Search.pm

filter: Statementstmt 57.1% 20 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 54.5% 6 / 11 Podpod 100% 1 / 1 totaltotal 42.8% 27 / 63 CC 7 SCAR 20.9
CC
7
Cov
42%
_process_request
20.0
_check_args
12.0
_prepare_wheel
6.0
CRAP 8.1
↑ Summary
1 package POE::Component::WWW::OhNoRobotCom::Search;
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 = '0.003';
7  
8 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use WWW::OhNoRobotCom::Search;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use base 'POE::Component::NonBlockingWrapper::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub _methods_define {
Subroutine _methods_define: not called CC=1 SCAR=6.9
14 0 return ( search => '_wheel_entry' );
15 }
16  
17 0 ▶sub search {
Subroutine search: not called CC=1 SCAR=6.9
Pod documented
18 0 $poe_kernel->post( shift->{session_id} => search => @_ );
19 }
20  
21 0 ▶sub _prepare_wheel {
Subroutine _prepare_wheel: not called CC=2 SCAR=17.9
22 0 my ( $self, $args ) = @_;
23 $self->{_robo} = WWW::OhNoRobotCom::Search->new(
24 0 ▶ %{ $self->{obj_args} || {} }
Condition0%0/2
$self->{'obj_args'} || {}
l!l
00
MC/DC0%0/1
$self->{'obj_args'} || {}
$self->{'obj_args'}
Truth table0%0/2
A
A= $self->{'obj_args'}
Aresult
11
00
25 );
26 }
27  
28 0 ▶sub _check_args {
Subroutine _check_args: not called CC=3 SCAR=24.8
29 0 my ( $self, $args_ref ) = @_;
30 defined $args_ref->{term}
31 0 ▶ or carp 'Missing `term` argument'
Branch: 1 branch
BranchTrueFalseTotal
defined $args_ref->{"term"} or carp("Missing `term` argument") and return 0 0 0
Condition0%0/5
defined $args_ref->{'term'} || carp('Missing `term` argument') && (return)
l!l&&r!l&&!r
000
carp("Missing `term` argument") and return
!ll
00
MC/DC0%0/2
defined $args_ref->{'term'} || carp('Missing `term` argument') && (return)
defined $args_ref->{'term'} carp("Missing `term` argument")
Truth table0%0/3
A || B
A= defined $args_ref->{'term'}B= carp("Missing `term` argument")
ABresult
1X1
011
000
32 and return;
33 }
34  
35 0 ▶sub _process_request {
Subroutine _process_request: not called CC=4 SCAR=30.0
36 0 my ( $self, $in_ref ) = @_;
37 0 my @search_args;
38 0 for ( qw(comic_id include max_results lucky) ) {
39 exists $in_ref->{$_}
40 0 ▶ and push @search_args, $_, $in_ref->{$_};
Branch: 1 branch
BranchTrueFalseTotal
exists $in_ref->{$_} and push @search_args, $_, $in_ref->{$_} 0 0 0
41 }
42  
43 0 my $out_ref = $self->{_robo}->search( $in_ref->{term}, @search_args );
44  
45 0 ▶ if ( defined $out_ref ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $out_ref) { } 0 0 0
46 0 $in_ref->{results} = $out_ref;
47 }
48 else {
49 0 $in_ref->{error} = $self->{_robo}->error;
50 }
51 }
52  
53 2 1;
54 __END__
↑ Summary