APIClient/Utils/HTTPResponse.pm

filter: Statementstmt 31.8% 7 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 4 totaltotal 26.4% 9 / 34 CC 3 SCAR 17.0
CC
3
Cov
29%
header
12.0
new
2.0
code
2.0
CRAP 5.5
« APIClient.pm ↑ Summary APIClient/Transport/CLISync.pm »
1 package cPanel::APIClient::Utils::HTTPResponse;
2  
3 # Copyright 2020 cPanel, L. L. C.
4 # All rights reserved.
5 # http://cpanel.net
6 #
7 # This is free software; you can redistribute it and/or modify it under the
8 # same terms as Perl itself. See L<perlartistic>.
9  
10 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # Right now these are the only pieces of HTTP::Response that we need.
14 # HTTP::Response is fairly large, so since we only need a small part of it,
15 # we implement those parts ourselves.
16  
17 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
18 0 my ( $class, $code, $resp_head, $resp_body ) = @_;
19  
20 0 return bless [ $code, $resp_head, $resp_body ], $class;
21 }
22  
23 0 ▶sub code {
Subroutine code: not called CC=1 SCAR=6.9
Pod undocumented
24 0 my ($self) = @_;
25  
26 0 return $self->[0];
27 }
28  
29 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
30 0 my ($self) = @_;
31  
32 0 return $self->[1] . $self->[2];
33 }
34  
35 # needed for sessions
36 0 ▶sub header {
Subroutine header: not called CC=3 SCAR=24.8
Pod undocumented
37 0 my ( $self, $name ) = @_;
38  
39 0 $name =~ tr<A-Z><a-z>;
40  
41 0 my @lines = split m<\x0d?\x0a>, $self->[1];
42  
43 0 for my $line (@lines) {
44 0 my ( $thisname, $value ) = split m<\s*:\s*>, $line;
45 0 $thisname =~ tr<A-Z><a-z>;
46  
47 0 ▶ if ( $name eq $thisname ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq $thisname) 0 0 0
48 0 return $value;
49 }
50 }
51  
52 0 return undef;
53 }
54  
55 2 1;
« APIClient.pm ↑ Summary APIClient/Transport/CLISync.pm »