blib/lib/OOP/Private.pm

filter: Statementstmt 100% 35 / 35 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 11 / 11 Podpod 0.0% 0 / 2 totaltotal 96.4% 55 / 57 SCAR 13.9
CC
4
Cov
100%
__ANON__
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 4.0
↑ Summary
1 package OOP::Private;
2 3 our $VERSION = "1.0";
3  
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶no warnings "redefine";
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use Carp "croak";
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Attribute::Handlers;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub UNIVERSAL::Private :ATTR(CODE) {
13 3 ▶ my ($pkg, $sym, $fun) = @_;
Subroutine Private: called CC=1 SCAR=0.0
Pod undocumented
14  
15 3 *{$sym} = sub {
16 3 ▶ croak "Attempt to call private subroutine $pkg".'::'. *{$sym}{NAME} ." from outer code"
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless caller eq $pkg 2 1 3
17 unless caller eq $pkg;
18  
19 1 $fun -> (@_);
20 3 };
21 3 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 sub UNIVERSAL::Protected :ATTR(CODE) {
24 2 ▶ my ($pkg, $sym, $fun) = @_;
Subroutine Protected: called CC=1 SCAR=0.0
Pod undocumented
25  
26 2 *{$sym} = sub {
27 3 ▶ croak "Attempt to call protected subroutine $pkg".'::'. *{$sym}{NAME} ." from outer code"
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
unless caller eq $pkg or (caller)->UNIVERSAL::isa($pkg) 1 2 3
Condition100%3/3
caller eq $pkg or (caller)->UNIVERSAL::isa($pkg)
l!l&&r!l&&!r
111
MC/DC100%2/2
caller eq $pkg or (caller)->UNIVERSAL::isa($pkg)
caller eq $pkg (caller)->UNIVERSAL::isa($pkg)
Truth table100%3/3
A or B
A= caller eq $pkgB= (caller)->UNIVERSAL::isa($pkg)
ABresult
1X1
011
000
28 unless caller eq $pkg or caller -> UNIVERSAL::isa($pkg);
29  
30 2 $fun -> (@_);
31 2 };
32 3 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 3 1
↑ Summary