| 1 | package Tie::Autotie; | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = 0.03; | |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=3 SCAR=11.6
| |||||||||||||||||||||||||||||||||||||
| 11 | 1 | my ($class, $pkg, $use_args, $tie_args) = @_; | |||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | $use_args ||= []; | ||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$use_args ||= []
MC/DC0%0/1
$use_args ||= []
$use_args
Truth table50%1/2
A
A= $use_args
| |||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | $tie_args ||= []; | ||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tie_args ||= []
MC/DC0%0/1
$tie_args ||= []
$tie_args
Truth table50%1/2
A
A= $tie_args
| |||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | eval "use $pkg \@\$use_args; 1;"; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||
| 21 | 1 | *{$pkg . "::AUTOTIE_STORE"} = \&{$pkg . "::STORE"}; | |||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | *{$pkg . "::STORE"} = sub { | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=26.0
| |||||||||||||||||||||||||||||||||||||
| 23 | 16 | my ($self, $key, $value) = @_; | |||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||
| 25 | 16 | ▶ | if (ref $value) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 26 | 5 | ▶ | if (UNIVERSAL::isa($value, 'SCALAR') and $pkg->can('TIESCALAR')) { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
UNIVERSAL::isa($value, "SCALAR") and $pkg->can("TIESCALAR")
MC/DC0%0/2
UNIVERSAL::isa($value, "SCALAR") and $pkg->can("TIESCALAR")
UNIVERSAL::isa($value, "SCALAR")
$pkg->can("TIESCALAR")
Truth table33%1/3
A and B
A= UNIVERSAL::isa($value, "SCALAR")B= $pkg->can("TIESCALAR")
| |||||||||||||||||||||||||||||||||||||
| 27 | 0 | tie $$value, $pkg, @$tie_args; | |||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||
| 29 | ▶ | elsif (UNIVERSAL::isa($value, 'ARRAY') and $pkg->can('TIEARRAY')) { | |||||||||||||||||||||||||||||||||||
|
Condition33%1/3
UNIVERSAL::isa($value, "ARRAY") and $pkg->can("TIEARRAY")
MC/DC0%0/2
UNIVERSAL::isa($value, "ARRAY") and $pkg->can("TIEARRAY")
UNIVERSAL::isa($value, "ARRAY")
$pkg->can("TIEARRAY")
Truth table33%1/3
A and B
A= UNIVERSAL::isa($value, "ARRAY")B= $pkg->can("TIEARRAY")
| |||||||||||||||||||||||||||||||||||||
| 30 | 0 | tie @$value, $pkg, @$tie_args; | |||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||
| 32 | ▶ | elsif (UNIVERSAL::isa($value, 'HASH') and $pkg->can('TIEHASH')) { | |||||||||||||||||||||||||||||||||||
|
Condition33%1/3
UNIVERSAL::isa($value, "HASH") and $pkg->can("TIEHASH")
MC/DC0%0/2
UNIVERSAL::isa($value, "HASH") and $pkg->can("TIEHASH")
UNIVERSAL::isa($value, "HASH")
$pkg->can("TIEHASH")
Truth table33%1/3
A and B
A= UNIVERSAL::isa($value, "HASH")B= $pkg->can("TIEHASH")
| |||||||||||||||||||||||||||||||||||||
| 33 | 5 | tie %$value, $pkg, @$tie_args; | |||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||
| 37 | 16 | $self->AUTOTIE_STORE($key, $value); | |||||||||||||||||||||||||||||||||||
| 38 | 1 | }; | |||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||
| 42 | 1 | 1; | |||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||||||||||