| 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
| |||||||||||
| 15 | 0 | ▶ | $self->{'_api_args'} = $args if($args); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 36 | 0 | $self->header('Content-Length' => length($content)); | |||||||||
| 37 | 0 | $self->content($content); | |||||||||
| 38 | } | ||||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 1 | 1; | |||||||||