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