blib/lib/Class/Data/Lazy.pm

filter: Statementstmt 100% 28 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 100% 36 / 36 CC 2 SCAR 2.0
CC
2
Cov
100%
import
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 package Class::Data::Lazy;
2 2 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
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.01";
7  
8 2 ▶sub import {
Subroutine import: called CC=2 SCAR=6.9
9 2 my $class = shift;
10 2 my $pkg = caller(0);
11  
12 2 for my $name (@_) {
13 1 my $builder = "_build_${name}";
14 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶ *{"${pkg}::${name}"} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
16 1 my $class = shift;
17 1 my $value = $class->$builder();
18 2 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ *{"${class}::${name}"} = sub { $value };
Subroutine __ANON__: called CC=1 SCAR=0.0
20 1 return $value;
21 1 };
22 }
23 }
24  
25 2 1;
26 __END__
↑ Summary