line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eixo::Rest::RequestSync; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
142
|
|
4
|
3
|
|
|
3
|
|
17
|
use Eixo::Base::Clase 'Eixo::Rest::Request'; |
|
3
|
|
|
|
|
27
|
|
|
3
|
|
|
|
|
34
|
|
5
|
3
|
|
|
3
|
|
290
|
use Data::Dumper; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
714
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub send{ |
10
|
7
|
|
|
7
|
0
|
16
|
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
|
|
|
|
|
52
|
$self->start(); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#print Dumper($req); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $res = ($self->onProgress)? |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$ua->request($req, sub { |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
|
0
|
$self->progress(@_); |
40
|
|
|
|
|
|
|
|
41
|
7
|
50
|
|
|
|
65
|
}) : $ua->request($req); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#print Dumper($res); |
44
|
|
|
|
|
|
|
|
45
|
7
|
50
|
|
|
|
715722
|
if($res->is_success){ |
46
|
7
|
|
|
|
|
176
|
return $self->end($res); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else{ |
49
|
0
|
|
|
|
|
|
return $self->error($res); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |