line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Iron::ConnectorBase; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
## no critic (Documentation::RequirePodAtEnd) |
4
|
|
|
|
|
|
|
## no critic (Documentation::RequirePodSections) |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1513
|
use 5.010_000; |
|
3
|
|
|
|
|
12
|
|
7
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
77
|
|
8
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
86
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Global creator |
11
|
|
|
|
3
|
|
|
BEGIN { |
12
|
|
|
|
|
|
|
# Export nothing. |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Global destructor |
16
|
|
|
|
3
|
|
|
END { |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# ABSTRACT: Base class for the REST API Connector, HTTP interface class. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.12_01'; # TRIAL VERSION: generated by DZP::OurPkgVersion |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
3
|
|
20
|
use Log::Any qw{$log}; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
24
|
|
27
|
3
|
|
|
3
|
|
697
|
use Hash::Util 0.06 qw{lock_keys unlock_keys}; |
|
3
|
|
|
|
|
45
|
|
|
3
|
|
|
|
|
17
|
|
28
|
3
|
|
|
3
|
|
202
|
use Carp; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
188
|
|
29
|
3
|
|
|
3
|
|
35
|
use Carp::Assert; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
17
|
|
30
|
3
|
|
|
3
|
|
419
|
use Carp::Assert::More; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
532
|
|
31
|
3
|
|
|
3
|
|
21
|
use English '-no_match_vars'; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
18
|
|
32
|
3
|
|
|
3
|
|
1082
|
use Scalar::Util qw{blessed}; |
|
3
|
|
|
0
|
|
6
|
|
|
3
|
|
|
|
|
580
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# DEFAULTS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
0
|
|
|
3
|
1
|
0
|
my ($class) = @_; |
41
|
3
|
|
|
|
|
11
|
$log->tracef('Entering new(%s)', $class); |
42
|
3
|
|
|
|
|
21
|
my $self = {}; |
43
|
3
|
|
|
|
|
154
|
my @self_keys = ( ### no critic (CodeLayout::ProhibitQuotedWordLists) |
44
|
|
|
|
|
|
|
# No keys. |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
9
|
bless $self, $class; |
48
|
3
|
|
|
|
|
10
|
lock_keys(%{$self}, @self_keys); |
|
3
|
|
|
|
|
7
|
|
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
29
|
$log->tracef('Exiting new: %s', $self); |
51
|
3
|
|
|
|
|
61
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Connector needs: |
55
|
|
|
|
|
|
|
# all API info |
56
|
|
|
|
|
|
|
# params for API.href => if it's a mock! |
57
|
|
|
|
|
|
|
# message body |
58
|
|
|
|
|
|
|
# headers: content type, authorization |
59
|
|
|
|
|
|
|
# connection params: timeout?, retry? |
60
|
|
|
|
|
|
|
# Connector arranges by inself: |
61
|
|
|
|
|
|
|
# HTTP REST connection: REST::Client / LWP |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub perform_iron_action { |
66
|
|
|
|
|
|
|
#my ($self, $iron_action, $params) = @_; |
67
|
|
|
|
|
|
|
#if(!defined $params){ |
68
|
|
|
|
|
|
|
# $params = {}; |
69
|
|
|
|
|
|
|
#} |
70
|
|
|
|
|
|
|
#$log->tracef('Entering ConnectorBase:perform_iron_action(%s, %s)', $iron_action, $params); |
71
|
|
|
|
|
|
|
|
72
|
3
|
|
|
0
|
1
|
680
|
croak('This routine must be replaced in the inheriting sub class.'); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#my ($returned_msg, $http_status_code); |
75
|
|
|
|
|
|
|
#$log->tracef('Exiting ConnectorBase:perform_iron_action(): %s', $returned_msg ); |
76
|
|
|
|
|
|
|
#return $http_status_code, $returned_msg; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |