blib/lib/Data/Shared/Adapter.pm

filter: Statementstmt 100% 32 / 32 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 16 / 16 Podpod 0.0% 0 / 10 totaltotal 83.8% 52 / 62 CC 3 SCAR 2.0
CC
3
Cov
100%
perform
2.0
_spec
2.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Data/Shared/Adapter/Set.pm ↑ Summary Shared.xs »
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
BranchTrueFalseTotal
unless $code 65 15 80
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
BranchTrueFalseTotal
my $verbs = $entry->{"verbs"} or return undef 52162 6 52168
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__
« blib/lib/Data/Shared/Adapter/Set.pm ↑ Summary Shared.xs »