| 1 | package IO::Iron::ConnectorBase; | ||
| 2 | |||
| 3 | ## no critic (Documentation::RequirePodAtEnd) | ||
| 4 | ## no critic (Documentation::RequirePodSections) | ||
| 5 | |||
| 6 | 3 | ▶ | use 5.010_000; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | # Global creator | ||
| 11 | ▶ | BEGIN { | |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | # Export nothing. | ||
| 13 | } | ||
| 14 | |||
| 15 | # Global destructor | ||
| 16 | ▶ | END { | |
|
Subroutine
END: called CC=1 SCAR=0.0
| |||
| 17 | } | ||
| 18 | |||
| 19 | |||
| 20 | # ABSTRACT: Base class for the REST API Connector, HTTP interface class. | ||
| 21 | |||
| 22 | 3 | our $VERSION = '0.12_01'; # TRIAL VERSION: generated by DZP::OurPkgVersion | |
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | 3 | ▶ | use Log::Any qw{$log}; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | 3 | ▶ | use Hash::Util 0.06 qw{lock_keys unlock_keys}; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 3 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | 3 | ▶ | use Carp::Assert; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 3 | ▶ | use Carp::Assert::More; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | 3 | ▶ | use English '-no_match_vars'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | 3 | ▶ | use Scalar::Util qw{blessed}; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||
| 33 | |||
| 34 | |||
| 35 | # DEFAULTS | ||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | sub new { | ||
| 40 | 3 | ▶ | my ($class) = @_; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 41 | 3 | $log->tracef('Entering new(%s)', $class); | |
| 42 | 3 | my $self = {}; | |
| 43 | 3 | my @self_keys = ( ### no critic (CodeLayout::ProhibitQuotedWordLists) | |
| 44 | # No keys. | ||
| 45 | ); | ||
| 46 | |||
| 47 | 3 | bless $self, $class; | |
| 48 | 3 | lock_keys(%{$self}, @self_keys); | |
| 49 | |||
| 50 | 3 | $log->tracef('Exiting new: %s', $self); | |
| 51 | 3 | 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 | 0 | ▶ | croak('This routine must be replaced in the inheriting sub class.'); |
|
Subroutine
perform_iron_action: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 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 | 3 | 1; | |
| 80 | |||
| 81 | __END__ | ||