| 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'} || {}
MC/DC0%0/1
$self->{'obj_args'} || {}
$self->{'obj_args'}
Truth table0%0/2
A
A= $self->{'obj_args'}
| |||||||||||||||||||||||||||||||||
| 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
Condition0%0/5
defined $args_ref->{'term'} || carp('Missing `term` argument') && (return)
carp("Missing `term` argument") and return
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")
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||