| 1 | package Eixo::Rest::RequestSync; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use Eixo::Base::Clase 'Eixo::Rest::Request'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | |||||||||||
| 9 | 7 | ▶ | sub send{ | ||||||||
|
Subroutine
send: called CC=3 SCAR=12.3
Pod
undocumented
| |||||||||||
| 10 | 7 | my ($self, $ua, $req) = @_; | |||||||||
| 11 | |||||||||||
| 12 | # | ||||||||||
| 13 | # DEBUG HANDLERS: | ||||||||||
| 14 | # | ||||||||||
| 15 | # $ua->add_handler( | ||||||||||
| 16 | # response_data => sub { | ||||||||||
| 17 | # my($response, $ua, $h, $data) = @_; | ||||||||||
| 18 | # print "Recibimos chunk '$data' ca response $response"}, | ||||||||||
| 19 | # verbose => 1 | ||||||||||
| 20 | # ); | ||||||||||
| 21 | |||||||||||
| 22 | # $ua->add_handler( | ||||||||||
| 23 | # response_done => sub { | ||||||||||
| 24 | # my($response, $ua, $h) = @_; | ||||||||||
| 25 | # print "Finalizou a request: response = ".Dumper($response); | ||||||||||
| 26 | # }, | ||||||||||
| 27 | # verbose => 1 | ||||||||||
| 28 | # ); | ||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | 7 | $self->start(); | |||||||||
| 32 | |||||||||||
| 33 | #print Dumper($req); | ||||||||||
| 34 | |||||||||||
| 35 | my $res = ($self->onProgress)? | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | $ua->request($req, sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 38 | |||||||||||
| 39 | 0 | $self->progress(@_); | |||||||||
| 40 | |||||||||||
| 41 | 7 | ▶ | }) : $ua->request($req); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | #print Dumper($res); | ||||||||||
| 44 | |||||||||||
| 45 | 7 | ▶ | if($res->is_success){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 7 | return $self->end($res); | |||||||||
| 47 | } | ||||||||||
| 48 | else{ | ||||||||||
| 49 | 0 | return $self->error($res); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | # $self; | ||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 3 | 1; | |||||||||