Lazy/Ref.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 30 / 30 CC 2 SCAR 2.5
CC
2
Cov
100%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Lazy.pm ↑ Summary Lazy/Validate.pm »
1 package Object::Lazy::Ref; ## no critic (TidyCode)
2
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 2 our $VERSION = '0.12';
7
8 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9
10 2 my %register;
11
12 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 my $old_core_global_ref = *CORE::GLOBAL::ref;
14 366 ▶ *CORE::GLOBAL::ref = sub ($) {
Subroutine __ANON__: called CC=2 SCAR=6.9
15 366 my $ref = shift;
16
17 return
18 exists $register{$ref}
19 ? $register{$ref}
20 366 ▶ : do {
Branch: 1 branch
BranchTrueFalseTotal
exists $register{$ref} ? : 1 365 366
21 365 local *CORE::GLOBAL::ref = $old_core_global_ref;
22 365 ref $ref;
23 };
24 }
25 2 }
26
27 1 ▶sub register {
Subroutine register: called CC=1 SCAR=0.0
Pod documented
28 1 my $object = shift;
29
30 1 $register{$object} = $object->{ref};
31
32 1 return;
33 }
34
35 # $Id$
36
37 2 1;
38
39 __END__
« Lazy.pm ↑ Summary Lazy/Validate.pm »