Branch Coverage

lib/Net/API/CPAN/List.pm
Criterion Covered Total %
branch 55 208 26.4


line true false branch
38 1 0 unless exists $self->{'api'}
41 1 0 unless exists $self->{'container'}
44 1 0 unless exists $self->{'filter'}
46 1 0 unless exists $self->{'pageable'}
47 1 0 unless exists $self->{'page'}
49 1 0 unless exists $self->{'page_type'}
50 1 0 unless exists $self->{'postprocess'}
52 1 0 unless exists $self->{'preprocess'}
53 1 0 unless exists $self->{'request'}
55 1 0 unless exists $self->{'size'}
57 1 0 unless exists $self->{'size_prop'}
58 1 0 unless exists $self->{'timed_out'}
59 1 0 unless exists $self->{'took'}
60 1 0 unless exists $self->{'total'}
61 1 0 unless exists $self->{'type'}
64 0 1 unless $self->SUPER::init(@_)
65 1 0 unless (exists $self->{'api'} and $self->_is_a($self->{'api'}, "Net::API::CPAN"))
67 0 1 unless $self->_load_class("Net::API::CPAN")
83 0 0 if (@_)
85 0 0 unless $self->load_data(@_)
97 1 0 @_ ? :
100 0 1 unless (defined $data->[$pos])
102 0 0 if ($what eq "object" or $what eq "hash")
116 1 0 if ($filter = $self->filter)
124 1 0 if $total and $total > $size and $total - ($offset + 1) > 0
126 1 0 if $total and $total > $size and $total - ($offset + 1) > 0
134 0 8 if @_ == 1 and not defined $_[0]
135 1 7 if (@_)
139 0 1 unless $self->_is_array($ref)
147 0 10 if ref $ref->[$i] ne "HASH"
152 1 9 unless ($class = $cache->{$type})
156 0 1 unless $self->_load_class($class)
165 10 0 if exists $hash->{'_source'} and ref $hash->{'_source'} eq "HASH"
174 0 8 unless ($self->{'items'} and $self->_is_a($self->{'items'}, "Module::Generic::Array"))
176 0 0 defined $self->{'items'} ? :
194 0 0 if ($filter) { }
196 0 0 unless $filter->query
212 0 0 unless $self->load_data($data)
221 0 1 if ref $data ne "HASH"
227 0 1 if (my $code = $self->preprocess)
236 0 0 if ($@)
245 1 0 if ($container and $container eq 'hits' and exists $data->{$container} and ref $data->{$container} eq 'HASH' and exists $data->{$container}{'hits'} and ref $data->{$container}{'hits'} eq 'ARRAY' or not defined $container and exists $data->{'hits'} and ref $data->{'hits'} eq 'HASH' and exists $data->{'hits'}{'hits'} and ref $data->{'hits'}{'hits'} eq 'ARRAY') { }
260 1 0 unless (defined $container)
264 0 1 if (not exists $data->{'hits'} && defined $data->{'hits'} or ref $data->{'hits'} ne 'HASH') { }
0 1 elsif (not exists $data->{'hits'}{'hits'} && defined $data->{'hits'}{'hits'} or ref $data->{'hits'}{'hits'} ne 'ARRAY') { }
284 1 0 if (exists $data->{'hits'}{'total'} and defined $data->{'hits'}{'total'} and CORE::length $data->{'hits'}{'total'}) { }
304 0 0 unless ($container = $self->container)
308 0 0 if (defined $data->{$prop} and ref $data->{$prop} eq "ARRAY")
320 0 0 if (not defined $container) { }
0 0 elsif (not exists $data->{$container}) { }
0 0 elsif (not defined $data->{$container}) { }
0 0 elsif (ref $data->{$container} ne 'ARRAY') { }
343 0 0 if exists $data->{'total'} and CORE::length($data->{'total'} // "")
346 1 0 if (defined $ref) { }
360 1 0 if (not $self->type and scalar @$new_items and ref $new_items->[0] eq "HASH" and exists $new_items->[0]{'_type'} and CORE::length($new_items->[0]{'_type'} // ""))
369 0 1 if (not $new_items->is_empty || $old_items->is_empty and ref $new_items->first eq 'HASH' and ref $old_items->first eq 'HASH') { }
385 0 0 if ($@)
392 0 0 if (defined $new_serial and defined $old_serial and $new_serial eq $old_serial) { }
415 1 0 unless ($self->page_size)
425 1 0 if (exists $data->{'timed_out'} and defined $data->{'timed_out'} and CORE::length $data->{'timed_out'}) { }
436 1 0 if (exists $data->{'took'} and defined $data->{'took'} and CORE::length $data->{'took'}) { }
449 1 0 if (my $code = $self->postprocess)
458 0 1 if ($@)
469 1 1 unless exists $self->{'_pos'}
478 0 2 unless (defined $val)
481 0 0 if ($self->{'_pos'} > $data->size and $self->has_more)
490 0 0 if ($filter) { }
492 0 0 unless $filter->query
495 0 0 if (defined $size and not $size)
506 0 0 unless (scalar keys %$query and exists $query->{'page'} || exists $query->{'from'} || exists $query->{'size'})
513 0 0 if (defined $size)
521 0 0 if ($page_type eq 'from') { }
0 0 elsif ($page_type eq 'page') { }
544 0 0 unless $self->load("request", $req)
546 0 0 unless $self->items->is_empty
550 0 0 if ($what eq "object" or $what eq "hash")
564 3 0 if ($filter = $self->filter)
590 0 0 unless (defined $val)
592 0 0 if ($what eq "object" or $what eq "hash")
610 0 1 unless exists $self->{'_pos'}
614 1 0 if ($self->{'_pos'} - 1 >= 0)
619 0 1 unless (defined $val)
623 0 0 if ($self->{'_pos'} <= 0 and $page > 1)
632 0 0 if ($filter) { }
634 0 0 unless $filter->query
637 0 0 if (defined $size and not $size)
647 0 0 unless scalar keys %$query and CORE::length($query->{'q'} // "")
650 0 0 if (defined $size)
657 0 0 if ($page_type eq 'from') { }
0 0 elsif ($page_type eq 'page') { }
676 0 0 unless $self->load("request", $req)
678 0 0 unless $self->items->is_empty
681 0 0 if ($what eq "object" or $what eq "hash")
694 0 0 unless $self->_check($this)
709 0 0 unless (defined $val)
711 0 0 if ($what eq "object" or $what eq "hash")
739 0 0 unless $self->_check($this)
748 0 0 unless $self->_is_object($this)
752 0 0 if (not $data->is_empty and $self->_is_object($data->[0]))
754 0 0 if $data->[0]->can("object")
756 0 0 if ($this->can("object"))
759 0 0 unless defined $this_object and $this_object->defined
760 0 0 unless defined $obj_name and $obj_name->defined
761 0 0 if $this_object ne $obj_name