| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition50%3/6
defined $_ and not ref $_ and /^[^\W\d]\w*$/s
defined $_ and not ref $_
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||