| 1 | package Google::RestApi::SubResource; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | our $VERSION = '2.2.5'; | |||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 2 | ▶ | use Google::RestApi::Setup; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 124 | ▶ | sub api { | ||||||||||||||||||
|
Subroutine
api: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 8 | 124 | my $self = shift; | |||||||||||||||||||
| 9 | 124 | my %p = @_; | |||||||||||||||||||
| 10 | 124 | my $uri = $self->_uri_base(); | |||||||||||||||||||
| 11 | 124 | ▶ | $uri .= "/$self->{id}" if $self->{id}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 12 | 124 | ▶ | $uri .= "/$p{uri}" if $p{uri}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 13 | 124 | delete $p{uri}; | |||||||||||||||||||
| 14 | 124 | my $accessor = $self->_parent_accessor(); | |||||||||||||||||||
| 15 | 124 | return $self->$accessor()->api(%p, uri => $uri); | |||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 103 | ▶ | sub require_id { | ||||||||||||||||||
|
Subroutine
require_id: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 19 | 103 | my ($self, $method) = @_; | |||||||||||||||||||
| 20 | 103 | ▶ | LOGDIE $self->_resource_name() . " ID required for $method()" unless $self->{id}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 21 | 50 | return; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 50 | ▶ | sub _resource_name { | ||||||||||||||||||
|
Subroutine
_resource_name: called CC=2 SCAR=7.4
| |||||||||||||||||||||
| 25 | 50 | my $self = shift; | |||||||||||||||||||
| 26 | 50 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 27 | 50 | $class =~ /([^:]+)$/; | |||||||||||||||||||
| 28 | 50 | return $1; | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 0 | ▶ | sub _uri_base { LOGDIE ref(shift) . " must override _uri_base()"; } | ||||||||||||||||||
|
Subroutine
_uri_base: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 32 | 0 | ▶ | sub _parent_accessor { LOGDIE ref(shift) . " must override _parent_accessor()"; } | ||||||||||||||||||
|
Subroutine
_parent_accessor: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 2 | 1; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | __END__ | ||||||||||||||||||||