Fetch/Response.pm

filter: Statementstmt 23.5% 8 / 34 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 13.3% 2 / 15 Podpod 91.6% 11 / 12 totaltotal 27.6% 21 / 76 CC 7 SCAR 18.7
CC
7
Cov
17%
is_success
20.0
_var
6.0
is_redirect
6.0
CRAP 6.5
« Fetch.pm ↑ Summary
1 package URI::Fetch::Response;
2 1 $URI::Fetch::Response::VERSION = '0.15';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
7 0 my $class = shift;
8 0 my $feed = bless { }, $class;
9 0 $feed;
10 }
11  
12 0 ▶sub _var {
Subroutine _var: not called CC=2 SCAR=17.9
13 0 my $feed = shift;
14 0 my $var = shift;
15 0 ▶ $feed->{$var} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
16 0 $feed->{$var};
17 }
18  
19 0 ▶sub status { shift->_var('status', @_) }
Subroutine status: not called CC=1 SCAR=6.9
Pod documented
20 0 ▶sub http_status { shift->_var('http_status', @_) }
Subroutine http_status: not called CC=1 SCAR=6.9
Pod documented
21 0 ▶sub http_response { shift->_var('http_response', @_) }
Subroutine http_response: not called CC=1 SCAR=6.9
Pod documented
22 0 ▶sub etag { shift->_var('etag', @_) }
Subroutine etag: not called CC=1 SCAR=6.9
Pod documented
23 0 ▶sub last_modified { shift->_var('last_modified', @_) }
Subroutine last_modified: not called CC=1 SCAR=6.9
Pod documented
24 0 ▶sub uri { shift->_var('uri', @_) }
Subroutine uri: not called CC=1 SCAR=6.9
Pod documented
25 0 ▶sub content { shift->_var('content', @_) }
Subroutine content: not called CC=1 SCAR=6.9
Pod documented
26 0 ▶sub content_type { shift->_var('content_type', @_) }
Subroutine content_type: not called CC=1 SCAR=6.9
Pod documented
27  
28 0 ▶sub is_success {
Subroutine is_success: not called CC=4 SCAR=30.0
Pod documented
29 0 my $response = shift;
30 0 ▶ if ($response->http_response) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->http_response) 0 0 0
31 0 ▶ return 1 if $response->http_response->code == 304
Branch: 1 branch
BranchTrueFalseTotal
if $response->http_response->code == 304 and defined $response->content 0 0 0
Condition0%0/3
$response->http_response->code == 304 and defined $response->content
!ll&&!rl&&r
000
MC/DC0%0/2
$response->http_response->code == 304 and defined $response->content
$response->http_response->code == 304 defined $response->content
Truth table0%0/3
A and B
A= $response->http_response->code == 304B= defined $response->content
ABresult
0X0
100
111
32 && defined($response->content);
33 0 return $response->http_response->is_success;
34 }
35 0 return 1;
36 }
37  
38 0 ▶sub is_redirect {
Subroutine is_redirect: not called CC=2 SCAR=17.9
Pod documented
39 0 my $response = shift;
40 0 ▶ return $response->http_response->is_redirect if $response->http_response;
Branch: 1 branch
BranchTrueFalseTotal
if $response->http_response 0 0 0
41 0 return;
42 }
43  
44 0 ▶sub is_error {
Subroutine is_error: not called CC=2 SCAR=17.9
Pod documented
45 0 my $response = shift;
46 0 ▶ return $response->http_response->is_error if $response->http_response;
Branch: 1 branch
BranchTrueFalseTotal
if $response->http_response 0 0 0
47 0 return;
48 }
49  
50 1 1;
51 __END__
« Fetch.pm ↑ Summary