blib/lib/IO/Iron/ClientBase.pm

filter: Statementstmt 77.5% 31 / 40 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 10 / 14 Podpod 100% 4 / 4 totaltotal 75.0% 45 / 60 SCAR 7.3
CC
2
Cov
74%
_access_internal
6.0
project_id
2.0
connection
2.0
CRAP 2.1
« blib/lib/IO/Iron/IronCache/Client.pm ↑ Summary blib/lib/IO/Iron/IronMQ/Api.pm »
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
BranchTrueFalseTotal
if (defined $var_value) { } 0 0 0
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__
« blib/lib/IO/Iron/IronCache/Client.pm ↑ Summary blib/lib/IO/Iron/IronMQ/Api.pm »