blib/lib/Object/Tiny/RW.pm

filter: Statementstmt 100% 23 / 23 Branchbran 75.0% 9 / 12 Conditioncond 50.0% 3 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 82.3% 42 / 51 CC 9 SCAR 14.9
CC
9
Cov
85%
import
7.3
bar
2.0
foo
2.0
CRAP 4.4
↑ Summary
1 package Object::Tiny::RW;
2  
3 3 ▶use strict 'vars', 'subs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 require 5.004;
6 3 $Object::Tiny::RW::VERSION = '1.07';
7 }
8  
9 3 ▶sub import {
Subroutine import: called CC=7 SCAR=19.9
10 3 ▶ return unless shift eq 'Object::Tiny::RW';
Branch: 1 branch
BranchTrueFalseTotal
unless shift() eq "Object::Tiny::RW" 0 3 3
11 3 my $pkg = caller;
12 3 my $child = !! @{"${pkg}::ISA"};
13 eval join "\n",
14 "package $pkg;",
15 ($child ? () : "\@${pkg}::ISA = 'Object::Tiny::RW';"),
16 map {
17 3 ▶ defined and ! ref and /^[^\W\d]\w*$/s
Subroutine bar: called CC=2 SCAR=7.1
Subroutine foo: called CC=2 SCAR=7.1
Branch: 4 branches
BranchTrueFalseTotal
$child ? : 0 3 3
defined $_ and not ref $_ and /^[^\W\d]\w*$/s or die "Invalid accessor name '${_}'" 4 1 5
if (@_ > 1) 1 3 4
if (@_ > 1) 1 3 4
Condition50%3/6
defined $_ and not ref $_ and /^[^\W\d]\w*$/s
!ll&&!rl&&r
014
defined $_ and not ref $_
!ll&&!rl&&r
005
MC/DC33%1/3
defined $_ and not ref $_ and /^[^\W\d]\w*$/s
defined $_ not ref $_ /^[^\W\d]\w*$/s
Truth table50%2/4
A and not(B) and C
A= defined $_B= not ref $_C= /^[^\W\d]\w*$/s
ABCresult
0XX0
10X0
1100
1111
18 or die "Invalid accessor name '$_'";
19 4 "sub $_ { if (\@_ > 1) { \$_[0]->{$_} = \$_[1] } ; return \$_[0]->{$_} }\n"
20 } @_;
21 2 ▶ die "Failed to generate $pkg" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2 2
22 2 return 1;
23 }
24  
25 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
26 2 my $class = shift;
27 2 bless { @_ }, $class;
28 }
29  
30 3 1;
31  
32 __END__
↑ Summary