Cellucidate/Request.pm

filter: Statementstmt 69.2% 18 / 26 Branchbran 42.8% 6 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 2 totaltotal 59.5% 28 / 47 CC 8 SCAR 14.3
CC
8
Cov
60%
_xbuildUseragent
6.0
processResponse
4.7
processResponseAsArray
4.3
CRAP 4.2
« Cellucidate/SimulationRun.pm ↑ Summary Cellucidate/Base.pm »
1 package Bio::Cellucidate::Request;
2  
3 7 ▶use base REST::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use XML::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 32 ▶sub processResponse {
Subroutine processResponse: called CC=4 SCAR=15.5
Pod undocumented
7 32 my $self = shift;
8 32 ▶ die "No content!" unless (my $content = $self->responseContent);
Branch: 1 branch
BranchTrueFalseTotal
unless my $content = $self->responseContent 0 32 32
9 32 ▶ unless ($self->responseCode eq '200') {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->responseCode eq 200) 0 32 32
10 0 die "Invalid Request! Response Code: " . $self->responseCode . "\n" . $content;
11 }
12 32 ▶ if ($self->responseHeader('Content-Type') =~ /.*application\/xml.*/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->responseHeader('Content-Type') =~ m[.*application/xml.*]) { } 32 0 32
13 32 return eval { XMLin($content, ForceArray => 0, KeepRoot => 0, KeyAttr => [], NoAttr => 1, SuppressEmpty => undef) };
14 } else {
15 0 return $content;
16 }
17 }
18  
19 10 ▶sub processResponseAsArray {
Subroutine processResponseAsArray: called CC=4 SCAR=14.6
Pod undocumented
20 10 my $self = shift;
21 10 my $key = shift;
22
23 10 ▶ my $response_data = $self->processResponse->{$key} if $self->processResponse;
Branch: 1 branch
BranchTrueFalseTotal
if $self->processResponse 10 0 10
24  
25 10 ▶ return [] unless $response_data;
Branch: 1 branch
BranchTrueFalseTotal
unless $response_data 0 10 10
26 10 ▶ return ref($response_data) eq 'ARRAY' ? $response_data : [ $response_data ];
Branch: 1 branch
BranchTrueFalseTotal
ref $response_data eq 'ARRAY' ? : 10 0 10
27 }
28  
29  
30 0 ▶sub _xbuildUseragent {
Subroutine _xbuildUseragent: not called CC=2 SCAR=17.9
31 0 my $self = shift;
32  
33 0 ▶ return if $self->getUseragent();
Branch: 1 branch
BranchTrueFalseTotal
if $self->getUseragent 0 0 0
34  
35 0 my $ua = LWP::UserAgent->new;
36 0 $ua->agent("Bio::Cellucidate::Request/$Bio::Cellucidate::VERSION");
37 0 $self->setUseragent($ua);
38  
39 0 return;
40 }
41  
42 7 1;
« Cellucidate/SimulationRun.pm ↑ Summary Cellucidate/Base.pm »