| 1 | package Bio::Tools::EUtilities; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 19 | $Bio::Tools::EUtilities::VERSION = '1.77'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 19 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 19 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 19 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 19 | ▶ | use base qw(Bio::Root::IO Bio::Tools::EUtilities::EUtilDataI); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 19 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | # ABSTRACT: NCBI eutil XML parsers. | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # AUTHOR: Chris Fields <cjfields@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # OWNER: 2006-2013 Chris Fields | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # LICENSE: Perl_5 | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 19 | my %DATA_MODULE = ( | |||||||||||||||||||||||||||||||||||||||||
| 20 | 'esearch' => 'Query', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 'egquery' => 'Query', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 'espell' => 'Query', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 'epost' => 'Query', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 'elink' => 'Link', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 'einfo' => 'Info', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 'esummary' => 'Summary', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 44 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 44 | my($caller,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 44 | ▶ | my $class = ref $caller || $caller; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $caller || $caller
MC/DC0%0/2
ref $caller || $caller
ref $caller
$caller
Truth table33%1/3
A || B
A= ref $callerB= $caller
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 44 | ▶ | if ($class =~ m{Bio::Tools::EUtilities::(\S+)}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 22 | my ($self) = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 34 | 22 | $self->_initialize(@args); | |||||||||||||||||||||||||||||||||||||||||
| 35 | 22 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 22 | my %param = @args; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 22 | @param{ map { lc $_ } keys %param } = values %param; # lowercase keys | |||||||||||||||||||||||||||||||||||||||||
| 39 | 22 | ▶ | my $eutil = $param{'-eutil'} || $class->throw("Need eutil to make instance"); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$param{'-eutil'} || $class->throw('Need eutil to make instance')
MC/DC0%0/2
$param{'-eutil'} || $class->throw('Need eutil to make instance')
$param{'-eutil'}
$class->throw('Need eutil to make instance')
Truth table33%1/3
A || B
A= $param{'-eutil'}B= $class->throw('Need eutil to make instance')
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 22 | ▶ | return unless( $class->_load_eutil_module( $DATA_MODULE{$eutil}) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 22 | return "Bio::Tools::EUtilities::$DATA_MODULE{$eutil}"->new(-datatype => lc $DATA_MODULE{$eutil}, | |||||||||||||||||||||||||||||||||||||||||
| 42 | -eutil => $eutil, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | @args); | ||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 22 | ▶ | sub _initialize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_initialize: called CC=8 SCAR=21.2
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 22 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 22 | my ($response, $pobj, $type, $eutil, $cache, $lazy) = | |||||||||||||||||||||||||||||||||||||||||
| 50 | $self->_rearrange([qw(RESPONSE | ||||||||||||||||||||||||||||||||||||||||||
| 51 | PARAMETERS | ||||||||||||||||||||||||||||||||||||||||||
| 52 | DATATYPE | ||||||||||||||||||||||||||||||||||||||||||
| 53 | EUTIL | ||||||||||||||||||||||||||||||||||||||||||
| 54 | CACHE_RESPONSE | ||||||||||||||||||||||||||||||||||||||||||
| 55 | LAZY)], @args); | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 22 | ▶ | $lazy ||= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$lazy ||= 0
MC/DC0%0/1
$lazy ||= 0
$lazy
Truth table50%1/2
A
A= $lazy
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 22 | ▶ | $cache ||= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$cache ||= 0
MC/DC0%0/1
$cache ||= 0
$cache
Truth table50%1/2
A
A= $cache
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 22 | $self->datatype($type); | |||||||||||||||||||||||||||||||||||||||||
| 59 | 22 | $self->eutil($eutil); | |||||||||||||||||||||||||||||||||||||||||
| 60 | # lazy parsing only implemented for elink and esummary (where returned data | ||||||||||||||||||||||||||||||||||||||||||
| 61 | # can be quite long). Also, no point to parsing lazily when the data is | ||||||||||||||||||||||||||||||||||||||||||
| 62 | # already in memory in an HTTP::Response object, so turn it off and chunk | ||||||||||||||||||||||||||||||||||||||||||
| 63 | # the Response object after parsing. | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 22 | ▶ | $response && $self->response($response); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 22 | ▶ | $pobj && $self->parameter_base($pobj); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 22 | $self->cache_response($cache); | |||||||||||||||||||||||||||||||||||||||||
| 67 | 22 | ▶ | $lazy = 0 if ($response) || ($eutil ne 'elink' && $eutil ne 'esummary'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$response or $eutil ne "elink" and $eutil ne "esummary"
$eutil ne "elink" and $eutil ne "esummary"
MC/DC66%2/3
$response or $eutil ne "elink" and $eutil ne "esummary"
$response
$eutil ne "elink"
$eutil ne "esummary"
Truth table75%3/4
A or B and C
A= $responseB= $eutil ne "elink"C= $eutil ne "esummary"
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | # setting parser to 'lazy' mode is permanent (can't reset later) | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 22 | $self->{'_lazy'} = $lazy; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 22 | $self->{'_parsed'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 19 | ▶ | sub cache_response { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cache_response: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 44 | my ($self, $cache) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 44 | ▶ | if (defined $cache) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 22 | ▶ | $self->{'_cache_response'} = ($cache) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 44 | return $self->{'_cache_response'}; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 22 | ▶ | sub response { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
response: called CC=4 SCAR=21.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 22 | my ($self, $response) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 22 | ▶ | if ($response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | $self->throw('Not an HTTP::Response object') unless (ref $response && $response->isa('HTTP::Response')); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $response and $response->isa("HTTP::Response")
MC/DC0%0/2
ref $response and $response->isa("HTTP::Response")
ref $response
$response->isa("HTTP::Response")
Truth table0%0/3
A and B
A= ref $responseB= $response->isa("HTTP::Response")
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $self->{'_response'} = $response; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 22 | return $self->{'_response'}; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 34 | ▶ | sub parameter_base { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parameter_base: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 34 | my ($self, $pb) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 34 | ▶ | if ($pb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 4 | ▶ | $self->throw('Not an Bio::ParameterBaseI object') unless (ref $pb && $pb->isa('Bio::ParameterBaseI')); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $pb and $pb->isa("Bio::ParameterBaseI")
MC/DC0%0/2
ref $pb and $pb->isa("Bio::ParameterBaseI")
ref $pb
$pb->isa("Bio::ParameterBaseI")
Truth table33%1/3
A and B
A= ref $pbB= $pb->isa("Bio::ParameterBaseI")
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 4 | ▶ | $self->warn('Not an Bio::Tools::EUtilities::EUtilParameters object; may experience some turbulence...') unless (ref $pb && $pb->isa('Bio::Tools::EUtilities::EUtilParameters')); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $pb and $pb->isa("Bio::Tools::EUtilities::EUtilParameters")
MC/DC0%0/2
ref $pb and $pb->isa("Bio::Tools::EUtilities::EUtilParameters")
ref $pb
$pb->isa("Bio::Tools::EUtilities::EUtilParameters")
Truth table33%1/3
A and B
A= ref $pbB= $pb->isa("Bio::Tools::EUtilities::EUtilParameters")
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 4 | $self->{'_parameter_base'} = $pb; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 34 | return $self->{'_parameter_base'}; | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 188 | ▶ | sub data_parsed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_parsed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 188 | return shift->{'_parsed'}; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 83 | ▶ | sub is_lazy { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_lazy: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 83 | return shift->{'_lazy'}; | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | { | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 19 | my %EUTIL_DATA = ( | |||||||||||||||||||||||||||||||||||||||||
| 118 | 'esummary' => [qw(DocSum Item)], | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 'epost' => [], | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 'egquery' => [], | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 'einfo' => [qw(Field Link)], | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 'elink' => [qw(LinkSet LinkSetDb LinkSetDbHistory IdUrlSet | ||||||||||||||||||||||||||||||||||||||||||
| 123 | Id IdLinkSet ObjUrl Link LinkInfo)], | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 'espell' => [qw(Original Replaced)], | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 'esearch' => [qw(Id ErrorList WarningList)], | ||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 22 | ▶ | sub parse_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_data: called CC=16 SCAR=41.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 22 | my $eutil = $self->eutil; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 22 | my $xs = XML::Simple->new(); | |||||||||||||||||||||||||||||||||||||||||
| 132 | 22 | ▶ | my $response = $self->response ? $self->response : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | $self->_fh ? $self->_fh : | ||||||||||||||||||||||||||||||||||||||||||
| 134 | $self->throw('No response or stream specified'); | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 22 | my $data; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 22 | ▶ | if ($eutil eq 'espell') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | $data = $self->_fix_espell($response); | |||||||||||||||||||||||||||||||||||||||||
| 139 | ▶ | } elsif ($response && $response->isa("HTTP::Response")) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$response and $response->isa("HTTP::Response")
MC/DC0%0/2
$response and $response->isa("HTTP::Response")
$response
$response->isa("HTTP::Response")
Truth table33%1/3
A and B
A= $responseB= $response->isa("HTTP::Response")
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | $data = $response->content; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 21 | $data = $response; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 22 | my $simple = $xs->XMLin($data, ForceArray => $EUTIL_DATA{$eutil}); | |||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | ## The ERROR element is #PCDATA only, so it can only have one text | ||||||||||||||||||||||||||||||||||||||||||
| 147 | ## element. However, it can still have zero text elements in | ||||||||||||||||||||||||||||||||||||||||||
| 148 | ## which case it will be a reference to an empty hash. | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 22 | ▶ | if (defined $simple->{ERROR} && ! ref($simple->{ERROR})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $simple->{"ERROR"} and not ref $simple->{"ERROR"}
MC/DC0%0/2
defined $simple->{"ERROR"} and not ref $simple->{"ERROR"}
defined $simple->{"ERROR"}
not ref $simple->{"ERROR"}
Truth table66%2/3
A and not(B)
A= defined $simple->{"ERROR"}B= not ref $simple->{"ERROR"}
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | ## Some errors may not be fatal but there doesn't seem to be a | ||||||||||||||||||||||||||||||||||||||||||
| 151 | ## way for us to know. So we warn. | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->warn("NCBI $eutil error: " . $simple->{ERROR}); | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 22 | ▶ | if ($simple->{InvalidIdList}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $self->warn("NCBI $eutil error: Invalid ID List".$simple->{InvalidIdList}); | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 22 | ▶ | if ($simple->{ErrorList} || $simple->{WarningList}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$simple->{"ErrorList"} or $simple->{"WarningList"}
MC/DC0%0/2
$simple->{"ErrorList"} or $simple->{"WarningList"}
$simple->{"ErrorList"}
$simple->{"WarningList"}
Truth table33%1/3
A or B
A= $simple->{"ErrorList"}B= $simple->{"WarningList"}
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | my @errorlist = @{ $simple->{ErrorList} } if $simple->{ErrorList}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my @warninglist = @{ $simple->{WarningList} } if $simple->{WarningList}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my ($err_warn); | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | for my $error (@errorlist) { | |||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $messages = join("\n\t",map {"$_ [".$error->{$_}.']'} | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | grep {!ref $error->{$_}} keys %$error); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $err_warn .= "Error : $messages"; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | for my $warn (@warninglist) { | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $messages = join("\n\t",map {"$_ [".$warn->{$_}.']'} | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | grep {!ref $warn->{$_}} keys %$warn); | |||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $err_warn .= "Warnings : $messages"; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | chomp($err_warn); | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $self->warn("NCBI $eutil Errors/Warnings:\n".$err_warn) | |||||||||||||||||||||||||||||||||||||||||
| 176 | # don't return as some data may still be useful | ||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 22 | ▶ | delete $self->{'_response'} unless $self->cache_response; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 22 | $self->{'_parsed'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 22 | $self->_add_data($simple); | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | # implemented only for elink/esummary, still experimental | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub parse_chunk { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_chunk: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $eutil = $self->eutil; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | my $tag = $eutil eq 'elink' ? 'LinkSet' : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | $eutil eq 'esummary' ? 'DocSum' : | ||||||||||||||||||||||||||||||||||||||||||
| 190 | $self->throw("Only eutil elink/esummary use parse_chunk()"); | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $xs = XML::Simple->new(); | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if ($self->response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->throw("Lazy parsing not implemented for HTTP::Response data yet"); | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | delete $self->{'_response'} if !$self->cache_response && $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->cache_response and $self->data_parsed
MC/DC0%0/2
not $self->cache_response and $self->data_parsed
not $self->cache_response
$self->data_parsed
Truth table0%0/3
not(A) and B
A= not $self->cache_responseB= $self->data_parsed
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | } else { # has to be a file/filehandle | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $fh = $self->_fh; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my ($chunk, $seendoc, $line); | |||||||||||||||||||||||||||||||||||||||||
| 198 | CHUNK: | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | while ($line = <$fh>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | next unless $seendoc || $line =~ m{^<$tag>}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$seendoc or $line =~ /^<$tag>/
MC/DC0%0/2
$seendoc or $line =~ /^<$tag>/
$seendoc
$line =~ /^<$tag>/
Truth table0%0/3
A or B
A= $seendocB= $line =~ /^<$tag>/
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $seendoc = 1; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $chunk .= $line; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | last if $line =~ m{^</$tag>}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if (!defined $line) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $self->{'_parsed'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | $self->_add_data( | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $xs->XMLin($chunk, forcearray => $EUTIL_DATA{$eutil}, KeepRoot => 1) | |||||||||||||||||||||||||||||||||||||||||
| 211 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 19 | ▶ | sub to_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: not called CC=3 SCAR=22.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $self->parse_data if ($self->can('parse_data') && !$self->data_parsed); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->can("parse_data") and not $self->data_parsed
MC/DC0%0/2
$self->can("parse_data") and not $self->data_parsed
$self->can("parse_data")
not $self->data_parsed
Truth table0%0/3
A and not(B)
A= $self->can("parse_data")B= not $self->data_parsed
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | return sprintf("%-20s:%s\n\n", 'EUtil', $self->eutil); | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub print_all { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_all: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $self->_print_handler(@args); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 23 | ▶ | sub get_ids { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ids: called CC=13 SCAR=26.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 23 | my ($self, $request) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 23 | my $eutil = $self->eutil; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 23 | ▶ | if ($self->is_lazy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->warn('get_ids() not implemented when using lazy mode'); | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 23 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 23 | ▶ | if ($eutil eq 'esearch') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 2 | ▶ | return $self->{'_id'} ? @{ $self->{'_id'} } : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | } elsif ($eutil eq 'elink') { | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 15 | my @ids; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 15 | ▶ | if ($request) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 4 | ▶ | if (ref $request eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | push @ids, map {$_->get_ids } | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | grep { $request->($_) } $self->get_LinkSets; | |||||||||||||||||||||||||||||||||||||||||
| 249 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 250 | push @ids, | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 14 | map { @{$_->[0]} } | |||||||||||||||||||||||||||||||||||||||||
| 252 | 16 | grep {grep { $_ eq $request } @{$_->[1]}} | |||||||||||||||||||||||||||||||||||||||||
| 253 | 4 | map {[[$_->get_ids], [$_->get_databases]]} $self->get_LinkSets; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 11 | ▶ | $self->warn('Multiple database present, IDs will be globbed together') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | if $self->get_linked_databases > 1; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 11 | push @ids, map {$_->get_ids } $self->get_LinkSets; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 15 | return @ids; | |||||||||||||||||||||||||||||||||||||||||
| 261 | } elsif ($eutil eq 'esummary') { | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 2 | ▶ | unless (exists $self->{'_id'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 2 | push @{$self->{'_id'}}, map {$_->get_id } $self->get_DocSums; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 2 | return @{$self->{'_id'}}; | |||||||||||||||||||||||||||||||||||||||||
| 266 | } elsif (my $pb = $self->parameter_base) { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | my $ids = $pb->id; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | return $ids ? @{$ids} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 270 | return () | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 3 | } | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 16 | ▶ | sub get_database { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_database: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 16 | return ($_[0]->get_databases)[0]; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 8 | ▶ | sub get_db { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_db: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 8 | return shift->get_database; | |||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 51 | ▶ | sub get_databases { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_databases: called CC=10 SCAR=23.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 51 | my ($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 51 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 51 | my $eutil = $self->eutil; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 51 | my @dbs; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 51 | ▶ | if ($eutil eq 'einfo' || $eutil eq 'espell') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%3/3
$eutil eq "einfo" or $eutil eq "espell"
MC/DC100%2/2
$eutil eq "einfo" or $eutil eq "espell"
$eutil eq "einfo"
$eutil eq "espell"
Truth table100%3/3
A or B
A= $eutil eq "einfo"B= $eutil eq "espell"
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | @dbs = $self->{'_dbname'} || | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 12 | ▶ | $self->{'_database'} || | ||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$self->{'_dbname'} || $self->{'_database'} || $self->get_available_databases
$self->{"_dbname"} or $self->{"_database"}
MC/DC0%0/3
$self->{'_dbname'} || $self->{'_database'} || $self->get_available_databases
$self->{"_dbname"}
$self->{"_database"}
$self->get_available_databases
Truth table75%3/4
A or B || C
A= $self->{"_dbname"}B= $self->{"_database"}C= $self->get_available_databases
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | $self->get_available_databases; | ||||||||||||||||||||||||||||||||||||||||||
| 294 | } elsif ($eutil eq 'egquery') { | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 3 | @dbs = map {$_->get_database} ($self->get_GlobalQueries); | |||||||||||||||||||||||||||||||||||||||||
| 296 | } elsif ($eutil eq 'elink') { | ||||||||||||||||||||||||||||||||||||||||||
| 297 | # only unique dbs | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 24 | my %tmp; | |||||||||||||||||||||||||||||||||||||||||
| 299 | 114 | @dbs = sort grep {!$tmp{$_}++} | |||||||||||||||||||||||||||||||||||||||||
| 300 | 24 | map {($_->get_databases)} $self->get_LinkSets; | |||||||||||||||||||||||||||||||||||||||||
| 301 | } elsif ($self->parameter_base) { | ||||||||||||||||||||||||||||||||||||||||||
| 302 | 5 | ▶ | if ($self->parameter_base->eutil eq 'elink') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | @dbs = $self->parameter_base->dbfrom; | |||||||||||||||||||||||||||||||||||||||||
| 304 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 5 | @dbs = $self->parameter_base->db; | |||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 51 | return @dbs; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 3 | ▶ | sub get_dbs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_dbs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 3 | return shift->get_databases; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 4 | ▶ | sub next_History { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_History: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 319 | 4 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | $self->{'_histories_it'} = $self->generate_iterator('histories') | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 4 | ▶ | if (!exists $self->{'_histories_it'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 4 | my $hist = $self->{'_histories_it'}->(); | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | sub next_cookie { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_cookie: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | return shift->next_History; | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | sub get_Histories { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_Histories: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | ref $self->{'_histories'} ? return @{ $self->{'_histories'} } : return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 6 | ▶ | sub get_count { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_count: called CC=6 SCAR=19.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 6 | my ($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 340 | 6 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | # egquery | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 6 | ▶ | if ($self->datatype eq 'multidbquery') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 3 | ▶ | if (!$db) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $self->warn('Must specify database to get count from'); | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 3 | my ($gq) = grep {$_->get_database eq $db} $self->get_GlobalQueries; | |||||||||||||||||||||||||||||||||||||||||
| 348 | 3 | ▶ | $gq && return $gq->get_count; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $self->warn("Unknown database $db"); | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 351 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 3 | ▶ | return $self->{'_count'} || scalar($self->get_ids); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'_count'} || scalar $self->get_ids
MC/DC100%1/1
$self->{'_count'} || scalar $self->get_ids
$self->{'_count'}
Truth table100%2/2
A
A= $self->{'_count'}
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 6 | ▶ | sub get_term { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_term: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 6 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 6 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | $self->{'_term'} ? $self->{'_term'} : | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 6 | ▶ | $self->{'_query'} ? $self->{'_query'} : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | $self->parameter_base ? $self->parameter_base->term : | ||||||||||||||||||||||||||||||||||||||||||
| 363 | return; | ||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 3 | ▶ | sub get_translation_from { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_translation_from: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 369 | 3 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 3 | return $self->{'_translation'}->{'From'}; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 3 | ▶ | sub get_translation_to { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_translation_to: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 3 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 3 | return $self->{'_translation'}->{'To'}; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 3 | ▶ | sub get_retstart { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_retstart: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 383 | 3 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | 3 | return $self->{'_retstart'}; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 3 | ▶ | sub get_retmax { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_retmax: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 3 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | 3 | return $self->{'_retmax'}; | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | sub get_query_translation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_query_translation: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | return $self->{'_querytranslation'}; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | 3 | ▶ | sub get_corrected_query { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_corrected_query: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 3 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 3 | return $self->{'_correctedquery'}; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 4 | ▶ | sub get_replaced_terms { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_replaced_terms: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 4 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 4 | ▶ | if ($self->{'_spelledquery'} && $self->{'_spelledquery'}->{Replaced}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"_spelledquery"} and $self->{"_spelledquery"}{"Replaced"}
MC/DC50%1/2
$self->{"_spelledquery"} and $self->{"_spelledquery"}{"Replaced"}
$self->{"_spelledquery"}
$self->{"_spelledquery"}{"Replaced"}
Truth table66%2/3
A and B
A= $self->{"_spelledquery"}B= $self->{"_spelledquery"}{"Replaced"}
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | ref $self->{'_spelledquery'}->{Replaced} ? | ||||||||||||||||||||||||||||||||||||||||||
| 414 | 2 | ▶ | return @{ $self->{'_spelledquery'}->{Replaced} } : return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub next_GlobalQuery { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_GlobalQuery: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | $self->{'_globalqueries_it'} = $self->generate_iterator('globalqueries') | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if (!exists $self->{'_globalqueries_it'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $self->{'_globalqueries_it'}->(); | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | 8 | ▶ | sub get_GlobalQueries { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_GlobalQueries: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 430 | 8 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 8 | ▶ | ref $self->{'_globalqueries'} ? return @{ $self->{'_globalqueries'} } : return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | sub print_GlobalQueries { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_GlobalQueries: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $self->_print_handler(@args, -type => 'GlobalQuery'); | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub next_DocSum { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_DocSum: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | if(!$self->data_parsed && !$self->is_lazy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->data_parsed or $self->is_lazy
MC/DC0%0/2
$self->data_parsed or $self->is_lazy
$self->data_parsed
$self->is_lazy
Truth table0%0/3
A or B
A= $self->data_parsedB= $self->is_lazy
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | $self->parse_data; | |||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | $self->{'_docsums_it'} = $self->generate_iterator('docsums') | ||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | if (!exists $self->{'_docsums_it'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | $self->{'_docsums_it'}->(); | |||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 4 | ▶ | sub get_DocSums { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_DocSums: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 454 | 4 | ▶ | if ($self->is_lazy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $self->warn('get_DocSums() not implemented when using lazy mode'); | |||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 4 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 4 | ▶ | return ref $self->{'_docsums'} ? @{ $self->{'_docsums'} } : return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | sub print_DocSums { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_DocSums: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $self->_print_handler(@args, -type => 'DocSum'); | |||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | 3 | ▶ | sub get_available_databases { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_available_databases: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 471 | 3 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | ($self->{'_available_databases'}) ? | ||||||||||||||||||||||||||||||||||||||||||
| 473 | 3 | ▶ | return @{($self->{'_available_databases'})} : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | return (); | ||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | 2 | ▶ | sub get_record_count { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_record_count: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | return $self->{'_count'} | |||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | ▶ | sub get_last_update { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_last_update: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 487 | 2 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | 2 | return $self->{'_lastupdate'} | |||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 2 | ▶ | sub get_menu_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_menu_name: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 493 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 494 | 2 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | exists $self->{'_menuname'} ? return $self->{'_menuname'} : | ||||||||||||||||||||||||||||||||||||||||||
| 496 | 2 | ▶ | exists $self->{'_menu'} ? return $self->{'_menu'} : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | return; | ||||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 2 | ▶ | sub get_description { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_description: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 503 | 2 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | return $self->{'_description'}; | |||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | sub next_FieldInfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_FieldInfo: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | $self->{'_fieldinfo_it'} = $self->generate_iterator('fieldinfo') | ||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | if (!exists $self->{'_fieldinfo_it'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | $self->{'_fieldinfo_it'}->(); | |||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 2 | ▶ | sub get_FieldInfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_FieldInfo: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 519 | 2 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | 2 | ▶ | return ref $self->{'_fieldinfo'} ? @{ $self->{'_fieldinfo'} } : return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 19 | *get_FieldInfos = \&get_FieldInfo; | |||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | sub next_LinkInfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_LinkInfo: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | $self->{'_linkinfo_it'} = $self->generate_iterator('linkinfo') | ||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | if (!exists $self->{'_linkinfo_it'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | $self->{'_linkinfo_it'}->(); | |||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 2 | ▶ | sub get_LinkInfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_LinkInfo: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 537 | 2 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | 2 | ▶ | return ref $self->{'_linkinfo'} ? @{ $self->{'_linkinfo'} } : return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | 19 | *get_LinkInfos = \&get_LinkInfo; | |||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | sub print_FieldInfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_FieldInfo: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $self->_print_handler(@args, -type => 'FieldInfo'); | |||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | sub print_LinkInfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_LinkInfo: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $self->_print_handler(@args, -type => 'LinkInfo'); | |||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | sub next_LinkSet { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_LinkSet: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 558 | #$self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | if(!$self->data_parsed && !$self->is_lazy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->data_parsed or $self->is_lazy
MC/DC0%0/2
$self->data_parsed or $self->is_lazy
$self->data_parsed
$self->is_lazy
Truth table0%0/3
A or B
A= $self->data_parsedB= $self->is_lazy
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $self->parse_data; | |||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | $self->{'_linksets_it'} = $self->generate_iterator('linksets') | ||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | if (!exists $self->{'_linksets_it'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | $self->{'_linksets_it'}->(); | |||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | # add support for retrieval of data if lazy parsing is enacted | ||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 52 | ▶ | sub get_LinkSets { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_LinkSets: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | 52 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 572 | 52 | ▶ | if ($self->is_lazy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | $self->warn('get_LinkSets() not implemented when using lazy mode'); | |||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | 52 | ▶ | $self->parse_data unless $self->data_parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 577 | 52 | ▶ | return ref $self->{'_linksets'} ? @{ $self->{'_linksets'} } : return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | sub print_LinkSets { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_LinkSets: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | $self->_print_handler(@args, -type => 'LinkSet'); | |||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 11 | ▶ | sub get_linked_databases { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_linked_databases: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 11 | ▶ | return $self->get_databases if $self->eutil eq 'elink'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | { | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 19 | my %VALID_ITERATORS = ( | |||||||||||||||||||||||||||||||||||||||||
| 596 | 'globalqueries' => 'globalqueries', | ||||||||||||||||||||||||||||||||||||||||||
| 597 | 'fieldinfo' => 'fieldinfo', | ||||||||||||||||||||||||||||||||||||||||||
| 598 | 'fieldinfos' => 'fieldinfo', | ||||||||||||||||||||||||||||||||||||||||||
| 599 | 'linkinfo' => 'linkinfo', | ||||||||||||||||||||||||||||||||||||||||||
| 600 | 'linkinfos' => 'linkinfo', | ||||||||||||||||||||||||||||||||||||||||||
| 601 | 'linksets' => 'linksets', | ||||||||||||||||||||||||||||||||||||||||||
| 602 | 'docsums' => 'docsums', | ||||||||||||||||||||||||||||||||||||||||||
| 603 | 'histories' => 'histories' | ||||||||||||||||||||||||||||||||||||||||||
| 604 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | sub rewind { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rewind: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | my ($self, $arg) = ($_[0], lc $_[1]); | |||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | my $eutil = $self->eutil; | |||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | if ($self->is_lazy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $self->warn('rewind() not implemented yet when running in lazy mode'); | |||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | $arg ||= 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg ||= "all"
MC/DC0%0/1
$arg ||= "all"
$arg
Truth table0%0/2
A
A= $arg
| |||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | if (exists $VALID_ITERATORS{$arg}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | delete $self->{'_'.$arg.'_it'}; | |||||||||||||||||||||||||||||||||||||||||
| 617 | } elsif ($arg eq 'all') { | ||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | for my $it (values %VALID_ITERATORS){ | |||||||||||||||||||||||||||||||||||||||||
| 619 | delete $self->{'_'.$it.'_it'} if | ||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | exists $self->{'_'.$it.'_it'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | map {$_->rewind('all')} $self->get_LinkSets; | |||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | map {$_->rewind('all')} $self->get_DocSums; | |||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | 4 | ▶ | sub generate_iterator { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_iterator: called CC=5 SCAR=24.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 629 | 4 | my ($self, $obj) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 630 | 4 | ▶ | if (!$obj) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | $self->throw('Must provide object type to iterate'); | |||||||||||||||||||||||||||||||||||||||||
| 632 | } elsif (!exists $VALID_ITERATORS{$obj}) { | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | $self->throw("Unknown object type [$obj]"); | |||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||
| 635 | 4 | my $cb = $self->callback; | |||||||||||||||||||||||||||||||||||||||||
| 636 | 4 | ▶ | if ($self->is_lazy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | my $type = $self->eutil eq 'esummary' ? '_docsums' : '_linksets'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $self->{$type} = []; | |||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | if (!@{$self->{$type}}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | $self->parse_chunk; # fill the queue | |||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | while (my $obj = shift @{$self->{$type}}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | if ($cb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | ($cb->($obj)) ? return $obj : next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 646 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | return $obj; | |||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||
| 653 | 4 | my $loc = '_'.$VALID_ITERATORS{$obj}; | |||||||||||||||||||||||||||||||||||||||||
| 654 | 4 | my $index = $#{$self->{$loc}}; | |||||||||||||||||||||||||||||||||||||||||
| 655 | 4 | my $current = 0; | |||||||||||||||||||||||||||||||||||||||||
| 656 | 4 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | 4 | ▶ | while ($current <= $index) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | 2 | ▶ | if ($cb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | if (my $d = $cb->($self->{$loc}->[$current])) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | return $self->{$loc}->[$current++] } | |||||||||||||||||||||||||||||||||||||||||
| 661 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | $current++; | |||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||
| 665 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 2 | return $self->{$loc}->[$current++] | |||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||
| 669 | 2 | undef; | |||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||
| 671 | 4 | } | |||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||
| 677 | 19 | ▶ | sub callback { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callback: called CC=4 SCAR=20.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 678 | 4 | my ($self, $cb) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 679 | 4 | ▶ | if ($cb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | delete $self->{'_cb'} if ($cb eq 'reset'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | return if ref $cb ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $self->{'_cb'} = $cb; | |||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 684 | 4 | return $self->{'_cb'}; | |||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | # Object printing methods | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | { | ||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | my $DEF_HANDLER = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | return $obj->to_string."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 693 | 19 | }; | |||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 19 | my %HANDLER = ( | |||||||||||||||||||||||||||||||||||||||||
| 696 | 'DocSum' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 697 | 'FieldInfo' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 698 | 'LinkInfo' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 699 | 'GlobalQuery' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 700 | 'LinkSet' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 701 | 'all' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 702 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | ▶ | sub _print_handler { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_print_handler: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | my ($file, $fh, $cb, $wrap, $type, $all) = $self->_rearrange([qw(FILE FH CB WRAP TYPE ALL)], @_); | |||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | $type ||= 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$type ||= "all"
MC/DC0%0/1
$type ||= "all"
$type
Truth table0%0/2
A
A= $type
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | # default formatting delegates to_string | ||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | ▶ | if (!$cb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 711 | $self->throw("Type $type not registered with print handler, exiting...") | ||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | if !exists($HANDLER{$type}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | $cb = $DEF_HANDLER; | |||||||||||||||||||||||||||||||||||||||||
| 714 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | $self->throw("Callback must be a code reference") if ref $cb ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | ▶ | $file ||= $fh; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$file ||= $fh
MC/DC0%0/2
$file ||= $fh
$file
$fh
Truth table0%0/3
A ||= B
A= $fileB= $fh
| |||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | $self->throw("Have defined both file and filehandle; only use one!") if $file && $fh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$file and $fh
MC/DC0%0/2
$file and $fh
$file
$fh
Truth table0%0/3
A and B
A= $fileB= $fh
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | my $io = ($file) ? Bio::Root::IO->new(-input => $file, -flush => 1) : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 721 | Bio::Root::IO->new(-flush => 1); # defaults to STDOUT | ||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | if ($type eq 'all') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | my $string = $cb->($self); | |||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | ▶ | $io->_print($string) if $string; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 726 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 727 | # set up iterator | ||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | my $it = "next_$type"; | |||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | $self->throw("Unknown iterator method $it") unless $self->can($it); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | while (my $obj = $self->$it) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | my $string = $cb->($obj); | |||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | $io->_print($string) if $string; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | $io->close; | |||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | # Private methods | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | 19 | ▶ | sub _seekable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_seekable: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | return shift->{'_seekable'} | |||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||
| 745 | # fixes odd bad XML issue espell data (still present 6-24-07) | ||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | 1 | ▶ | sub _fix_espell { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fix_espell: called CC=5 SCAR=19.1
| |||||||||||||||||||||||||||||||||||||||||||
| 748 | 1 | my ($self, $response) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 749 | 1 | my $temp; | |||||||||||||||||||||||||||||||||||||||||
| 750 | 1 | my $type = ref($response); | |||||||||||||||||||||||||||||||||||||||||
| 751 | 1 | ▶ | if ($type eq 'GLOB') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 752 | 1 | $temp .= $_ for <$response>; | |||||||||||||||||||||||||||||||||||||||||
| 753 | } elsif ($type eq 'HTTP::Response') { | ||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $temp = $response->content; | |||||||||||||||||||||||||||||||||||||||||
| 755 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | $self->throw("Unrecognized ref type $type"); | |||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||
| 758 | 1 | ▶ | if ($temp =~ m{^<html>}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | $self->throw("NCBI espell nonrecoverable error: HTML content returned") | |||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||
| 761 | 1 | $temp =~ s{<ERROR>(.*?)<ERROR>}{<ERROR>$1</ERROR>}; | |||||||||||||||||||||||||||||||||||||||||
| 762 | 1 | return $temp; | |||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | 22 | ▶ | sub _load_eutil_module { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_eutil_module: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 766 | 22 | my ($self, $class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 767 | 22 | my $ok; | |||||||||||||||||||||||||||||||||||||||||
| 768 | 22 | my $module = "Bio::Tools::EUtilities::" . $class; | |||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||
| 770 | 22 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 771 | 22 | $ok = $self->_load_module($module); | |||||||||||||||||||||||||||||||||||||||||
| 772 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 773 | 22 | ▶ | if ( $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | print STDERR <<END; | |||||||||||||||||||||||||||||||||||||||||
| 775 | $self: data module $module cannot be found | ||||||||||||||||||||||||||||||||||||||||||
| 776 | Exception $@ | ||||||||||||||||||||||||||||||||||||||||||
| 777 | For more information about the EUtilities system please see the EUtilities docs. | ||||||||||||||||||||||||||||||||||||||||||
| 778 | END | ||||||||||||||||||||||||||||||||||||||||||
| 779 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||||||||||||
| 781 | 22 | return $ok; | |||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||
| 784 | 19 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | __END__ | ||||||||||||||||||||||||||||||||||||||||||