| 1 | package Data::Shared::Adapter; | ||||||||||
| 2 | 40 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 40 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 40 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 40 | our $VERSION = '0.02'; | |||||||||
| 7 | |||||||||||
| 8 | 40 | our @CARP_NOT = qw(Data::Shared); | |||||||||
| 9 | |||||||||||
| 10 | # The facade calls every maker unconditionally; undef means take the slow path. | ||||||||||
| 11 | 4 | ▶ | sub make_verb { return undef } | ||||||||
|
Subroutine
make_verb: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 12 | 2 | ▶ | sub make_bound { return undef } | ||||||||
|
Subroutine
make_bound: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 13 | 5 | ▶ | sub make_push { return undef } | ||||||||
|
Subroutine
make_push: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 14 | 3 | ▶ | sub make_pop { return undef } | ||||||||
|
Subroutine
make_pop: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | 2 | ▶ | sub make_bound_push { return undef } | ||||||||
|
Subroutine
make_bound_push: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 16 | 1 | ▶ | sub make_bound_pop { return undef } | ||||||||
|
Subroutine
make_bound_pop: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 17 | 63 | ▶ | sub fast_verb { return undef } | ||||||||
|
Subroutine
fast_verb: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 18 | |||||||||||
| 19 | # Called whenever the matching maker returned undef; adapters override the wording. | ||||||||||
| 20 | 1 | ▶ | sub perform_push { Carp::croak("Data::Shared: push is not supported for this mount (use shared_call)") } | ||||||||
|
Subroutine
perform_push: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | 1 | ▶ | sub perform_pop { Carp::croak("Data::Shared: pop is not supported for this mount (use shared_call)") } | ||||||||
|
Subroutine
perform_pop: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 22 | |||||||||||
| 23 | 80 | ▶ | sub perform { | ||||||||
|
Subroutine
perform: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 24 | 80 | my ($class, $verb, $handle, $entry, $rest, @args) = @_; | |||||||||
| 25 | 80 | my $code = $class->make_verb($verb, $handle, $entry); | |||||||||
| 26 | 80 | ▶ | Carp::croak($class->_unsupported_verb($verb, $entry)) unless $code; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 15 | return $code->($rest, @args); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 63 | ▶ | sub _unsupported_verb { | ||||||||
|
Subroutine
_unsupported_verb: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 63 | my ($class, $verb, $entry) = @_; | |||||||||
| 32 | 63 | return "Data::Shared: operation '$verb' is not supported for $entry->{key} (use shared_call)"; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 52168 | ▶ | sub _spec { | ||||||||
|
Subroutine
_spec: called CC=2 SCAR=6.9
| |||||||||||
| 36 | 52168 | my ($entry, $verb) = @_; | |||||||||
| 37 | 52168 | ▶ | my $verbs = $entry->{verbs} or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 52162 | return $verbs->{$verb}; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 225 | ▶ | sub _unsupported { | ||||||||
|
Subroutine
_unsupported: called CC=1 SCAR=0.0
| |||||||||||
| 42 | 225 | my ($entry, $handle, $spec) = @_; | |||||||||
| 43 | 225 | return "Data::Shared: $entry->{key}: " . ref($handle) . " does not support '$spec'" | |||||||||
| 44 | . " (use shared_call for operations outside the generic verbs)"; | ||||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 40 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||