line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ArangoDB2::HTTP; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
83
|
use strict; |
|
21
|
|
|
|
|
31
|
|
|
21
|
|
|
|
|
644
|
|
4
|
21
|
|
|
21
|
|
80
|
use warnings; |
|
21
|
|
|
|
|
29
|
|
|
21
|
|
|
|
|
430
|
|
5
|
|
|
|
|
|
|
|
6
|
21
|
|
|
21
|
|
7324
|
use ArangoDB2::HTTP::LWP; |
|
21
|
|
|
|
|
53
|
|
|
21
|
|
|
|
|
4523
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# new |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# create new ArangoDB2::HTTP instance which will always be |
13
|
|
|
|
|
|
|
# one of the sub-classes of ArangoDB2::HTTP which implements |
14
|
|
|
|
|
|
|
# a particular HTTP client |
15
|
|
|
|
|
|
|
sub new |
16
|
|
|
|
|
|
|
{ |
17
|
1
|
|
|
1
|
1
|
2
|
my($self, $arango) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# see if specific http client is set |
20
|
1
|
50
|
|
|
|
4
|
if (my $http_client = $arango->http_client) { |
21
|
0
|
0
|
|
|
|
0
|
if ($http_client eq 'lwp') { |
|
|
0
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
return ArangoDB2::HTTP::LWP->new($arango); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
elsif ($http_client eq 'curl') { |
25
|
0
|
|
|
|
|
0
|
require ArangoDB2::HTTP::Curl; |
26
|
0
|
|
|
|
|
0
|
return ArangoDB2::HTTP::Curl->new($arango); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# if no client was set then use curl if possible |
31
|
|
|
|
|
|
|
# and if not fall back to LWP |
32
|
1
|
|
|
|
|
2
|
my $curl = eval { require WWW::Curl::Easy }; |
|
1
|
|
|
|
|
219
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
5
|
if ($curl) { |
35
|
0
|
|
|
|
|
0
|
require ArangoDB2::HTTP::Curl; |
36
|
0
|
|
|
|
|
0
|
return ArangoDB2::HTTP::Curl->new($arango); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
|
|
|
|
|
|
# for now use lwp client |
40
|
1
|
|
|
|
|
9
|
return ArangoDB2::HTTP::LWP->new($arango); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# arango |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# ArangoDB2 instance |
47
|
1
|
|
|
1
|
1
|
10
|
sub arango { $_[0]->{arango} } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# error |
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# get/set last error (HTTP status) code |
52
|
|
|
|
|
|
|
sub error |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
0
|
1
|
|
my($self, $error) = @_; |
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
$self->{error} = $error |
57
|
|
|
|
|
|
|
if defined $error; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return $self->{error}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |