| 1 | package IO::Iron::ClientBase; | ||||||||||
| 2 | |||||||||||
| 3 | ## no critic (Documentation::RequirePodAtEnd) | ||||||||||
| 4 | ## no critic (Documentation::RequirePodSections) | ||||||||||
| 5 | ## no critic (Subroutines::RequireArgUnpacking) | ||||||||||
| 6 | |||||||||||
| 7 | 7 | ▶ | use 5.010_000; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | # Global creator | ||||||||||
| 12 | ▶ | BEGIN { | |||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | # No exports | ||||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | # Global destructor | ||||||||||
| 17 | ▶ | END { | |||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | # ABSTRACT: Base package for Client Libraries to Iron services IronCache, IronMQ and IronWorker. | ||||||||||
| 22 | |||||||||||
| 23 | 7 | our $VERSION = '0.13'; # VERSION: generated by DZP::OurPkgVersion | |||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 7 | ▶ | use Log::Any qw{$log}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 7 | ▶ | use Hash::Util 0.06 qw{lock_keys unlock_keys}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 7 | ▶ | use Carp::Assert::More; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 7 | ▶ | use English '-no_match_vars'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | sub new { | ||||||||||
| 33 | 3 | ▶ | my ($class) = @_; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 3 | $log->tracef('Entering new(%s)', $class); | |||||||||
| 35 | 3 | my $self = {}; | |||||||||
| 36 | # These config items are used every time when a connection to REST is made. | ||||||||||
| 37 | 3 | 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 | bless $self, $class; | |||||||||
| 43 | 3 | lock_keys(%{$self}, @self_keys); | |||||||||
| 44 | |||||||||||
| 45 | 3 | $log->tracef('Exiting new: %s', $self); | |||||||||
| 46 | 3 | return $self; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub project_id { return $_[0]->_access_internal('project_id', $_[1]); } | ||||||||
|
Subroutine
project_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | ▶ | sub connection { return $_[0]->_access_internal('connection', $_[1]); } | ||||||||
|
Subroutine
connection: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | 0 | ▶ | sub last_http_status_code { return $_[0]->_access_internal('last_http_status_code', $_[1]); } | ||||||||
|
Subroutine
last_http_status_code: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 53 | |||||||||||
| 54 | # INTERNAL METHODS | ||||||||||
| 55 | # For use in the inheriting subclass | ||||||||||
| 56 | |||||||||||
| 57 | sub _access_internal { | ||||||||||
| 58 | 0 | ▶ | my ($self, $var_name, $var_value) = @_; | ||||||||
|
Subroutine
_access_internal: not called CC=2 SCAR=17.9
| |||||||||||
| 59 | 0 | $log->tracef('Entering _access_internal(%s, %s)', $var_name, $var_value); | |||||||||
| 60 | 0 | ▶ | if( defined $var_value ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | $self->{$var_name} = $var_value; | |||||||||
| 62 | 0 | return $self; | |||||||||
| 63 | } | ||||||||||
| 64 | else { | ||||||||||
| 65 | 0 | return $self->{$var_name}; | |||||||||
| 66 | } | ||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 7 | 1; | |||||||||
| 70 | |||||||||||
| 71 | __END__ | ||||||||||