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

filter: Statementstmt 57.1% 20 / 35 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 54.5% 6 / 11 Podpod 100% 1 / 1 totaltotal 43.5% 27 / 62 SCAR 28.2
CC
7
Cov
42%
_process_request
20.0
_check_args
12.0
_prepare_wheel
6.0
CRAP 16.7
↑ Summary Build »
1 package POE::Component::WWW::OhNoRobotCom::Search;
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 = '0.002';
7  
8 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use WWW::OhNoRobotCom::Search;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use base 'POE::Component::NonBlockingWrapper::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub _methods_define {
14 0 ▶ return ( search => '_wheel_entry' );
Subroutine _methods_define: not called CC=1 SCAR=6.9
15 }
16  
17 sub search {
18 0 ▶ $poe_kernel->post( shift->{session_id} => search => @_ );
Subroutine search: not called CC=1 SCAR=6.9
Pod documented
19 }
20  
21 sub _prepare_wheel {
22 0 ▶ my ( $self, $args ) = @_;
Subroutine _prepare_wheel: not called CC=2 SCAR=17.9
23 $self->{_robo} = WWW::OhNoRobotCom::Search->new(
24 0 ▶ %{ $self->{obj_args} || {} }
Branch: 1 branch
BranchTrueFalseTotal
$self->{"obj_args"} or {} 0 0 0
25 );
26 }
27  
28 sub _check_args {
29 0 ▶ my ( $self, $args_ref ) = @_;
Subroutine _check_args: not called CC=3 SCAR=24.8
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 sub _process_request {
36 0 ▶ my ( $self, $in_ref ) = @_;
Subroutine _process_request: not called CC=4 SCAR=30.0
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 1 1;
54 __END__
↑ Summary Build »