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
|
|
3060
|
use 5.010_000; |
|
7
|
|
|
|
|
25
|
|
8
|
7
|
|
|
7
|
|
42
|
use strict; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
142
|
|
9
|
7
|
|
|
7
|
|
34
|
use warnings; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
185
|
|
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.12_01'; # TRIAL VERSION: generated by DZP::OurPkgVersion |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
7
|
|
|
7
|
|
2490
|
use Log::Any qw{$log}; |
|
7
|
|
|
|
|
50615
|
|
|
7
|
|
|
|
|
48
|
|
27
|
7
|
|
|
7
|
|
15222
|
use Hash::Util 0.06 qw{lock_keys unlock_keys}; |
|
7
|
|
|
|
|
20244
|
|
|
7
|
|
|
|
|
51
|
|
28
|
7
|
|
|
7
|
|
4231
|
use Carp::Assert::More; |
|
7
|
|
|
|
|
31603
|
|
|
7
|
|
|
|
|
1177
|
|
29
|
7
|
|
|
7
|
|
3487
|
use English '-no_match_vars'; |
|
7
|
|
|
|
|
19376
|
|
|
7
|
|
|
|
|
42
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
3
|
|
|
3
|
1
|
11
|
my ($class) = @_; |
34
|
3
|
|
|
|
|
23
|
$log->tracef('Entering new(%s)', $class); |
35
|
3
|
|
|
|
|
140
|
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
|
|
|
|
|
7
|
bless $self, $class; |
43
|
3
|
|
|
|
|
8
|
lock_keys(%{$self}, @self_keys); |
|
3
|
|
|
|
|
37
|
|
44
|
|
|
|
|
|
|
|
45
|
3
|
|
|
|
|
185
|
$log->tracef('Exiting new: %s', $self); |
46
|
3
|
|
|
|
|
497
|
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__ |