| 1 | package Object::Tiny::RW::XS; | ||||||||||||||||||||||||||||||||||||||||||||||
| 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::XS::VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=7 SCAR=20.3
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | return unless shift eq 'Object::Tiny::RW::XS'; | ||||||||||||||||||||||||||||||||||||||||||||
|
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::XS';"), | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | "use Class::XSAccessor accessors => {", | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | (map { | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | defined and ! ref and /^[^\W\d]\w*$/s | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Branch: 2 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
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | or die "Invalid accessor name '$_'"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | "'$_' => '$_'," | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | } @_), | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | "};"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | die "Failed to generate $pkg" if $@; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | use Class::XSAccessor | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | ▶ | constructor => 'new'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||