API/Request.pm

filter: Statementstmt 41.3% 12 / 29 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 50.0% 1 / 2 totaltotal 38.1% 16 / 42 CC 4 SCAR 18.5
CC
4
Cov
34%
new
12.0
encode_args
6.0
BEGIN
1.0
CRAP 6.4
« API/Todo.pm ↑ Summary API/Response.pm »
1 package WebService::30Boxes::API::Request;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use HTTP::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '1.05';
8 1 our @ISA = qw/HTTP::Request/;
9  
10 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
11 0 my ($class, $meth, $args) = @_;
12  
13 0 my $self = new HTTP::Request;
14 0 ▶ $self->{'_api_meth'} = $meth if($meth);
Branch: 1 branch
BranchTrueFalseTotal
if $meth 0 0 0
15 0 ▶ $self->{'_api_args'} = $args if($args);
Branch: 1 branch
BranchTrueFalseTotal
if $args 0 0 0
16  
17 0 bless $self, $class;
18  
19 0 $self->method('POST');
20 0 $self->uri('http://30boxes.com/api/api.php');
21  
22 0 return $self;
23 }
24  
25 0 ▶sub encode_args {
Subroutine encode_args: not called CC=2 SCAR=17.9
Pod undocumented
26 0 my $self = shift;
27  
28 0 my $url = URI->new('http:');
29 $url->query_form(
30 method => $self->{'_api_meth'},
31 0 %{$self->{'_api_args'}});
32 0 my $content = $url->query;
33  
34 0 $self->header('Content-Type' => 'application/x-www-form-urlencoded');
35 0 ▶ if (defined($content)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $content) 0 0 0
36 0 $self->header('Content-Length' => length($content));
37 0 $self->content($content);
38 }
39 }
40  
41 1 1;
« API/Todo.pm ↑ Summary API/Response.pm »