line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Iron::ClientBase; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
## no critic (Documentation::RequirePodAtEnd) |
4
|
|
|
|
|
|
|
## no critic (Documentation::RequirePodSections) |
5
|
|
|
|
|
|
|
## no critic (Subroutines::RequireArgUnpacking) |
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
2923
|
use 5.010_000; |
|
7
|
|
|
|
|
25
|
|
8
|
7
|
|
|
7
|
|
34
|
use strict; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
143
|
|
9
|
7
|
|
|
7
|
|
33
|
use warnings; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
168
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Global creator |
12
|
|
|
|
7
|
|
|
BEGIN { |
13
|
|
|
|
|
|
|
# No exports |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Global destructor |
17
|
|
|
|
7
|
|
|
END { |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# ABSTRACT: Base package for Client Libraries to Iron services IronCache, IronMQ and IronWorker. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.13'; # VERSION: generated by DZP::OurPkgVersion |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
7
|
|
|
7
|
|
2273
|
use Log::Any qw{$log}; |
|
7
|
|
|
|
|
61153
|
|
|
7
|
|
|
|
|
41
|
|
27
|
7
|
|
|
7
|
|
20176
|
use Hash::Util 0.06 qw{lock_keys unlock_keys}; |
|
7
|
|
|
|
|
19437
|
|
|
7
|
|
|
|
|
43
|
|
28
|
7
|
|
|
7
|
|
3951
|
use Carp::Assert::More; |
|
7
|
|
|
|
|
37033
|
|
|
7
|
|
|
|
|
1068
|
|
29
|
7
|
|
|
7
|
|
3553
|
use English '-no_match_vars'; |
|
7
|
|
|
|
|
18791
|
|
|
7
|
|
|
|
|
40
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
3
|
|
|
3
|
1
|
9
|
my ($class) = @_; |
34
|
3
|
|
|
|
|
13
|
$log->tracef('Entering new(%s)', $class); |
35
|
3
|
|
|
|
|
141
|
my $self = {}; |
36
|
|
|
|
|
|
|
# These config items are used every time when a connection to REST is made. |
37
|
3
|
|
|
|
|
11
|
my @self_keys = ( ## no critic (CodeLayout::ProhibitQuotedWordLists) |
38
|
|
|
|
|
|
|
'project_id', # The ID of the project to use for requests. |
39
|
|
|
|
|
|
|
'connection', # Reference to a IO::Iron::Connection object. |
40
|
|
|
|
|
|
|
'last_http_status_code', # Contains the HTTP return code after a successful call to the remote host. |
41
|
|
|
|
|
|
|
); |
42
|
3
|
|
|
|
|
8
|
bless $self, $class; |
43
|
3
|
|
|
|
|
5
|
lock_keys(%{$self}, @self_keys); |
|
3
|
|
|
|
|
21
|
|
44
|
|
|
|
|
|
|
|
45
|
3
|
|
|
|
|
171
|
$log->tracef('Exiting new: %s', $self); |
46
|
3
|
|
|
|
|
479
|
return $self; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
1
|
|
sub project_id { return $_[0]->_access_internal('project_id', $_[1]); } |
51
|
0
|
|
|
0
|
1
|
|
sub connection { return $_[0]->_access_internal('connection', $_[1]); } |
52
|
0
|
|
|
0
|
1
|
|
sub last_http_status_code { return $_[0]->_access_internal('last_http_status_code', $_[1]); } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# INTERNAL METHODS |
55
|
|
|
|
|
|
|
# For use in the inheriting subclass |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _access_internal { |
58
|
0
|
|
|
0
|
|
|
my ($self, $var_name, $var_value) = @_; |
59
|
0
|
|
|
|
|
|
$log->tracef('Entering _access_internal(%s, %s)', $var_name, $var_value); |
60
|
0
|
0
|
|
|
|
|
if( defined $var_value ) { |
61
|
0
|
|
|
|
|
|
$self->{$var_name} = $var_value; |
62
|
0
|
|
|
|
|
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
0
|
|
|
|
|
|
return $self->{$var_name}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |