| 1 | 1 | ▶ | use 5.008003; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package JavaScript::Any::Context; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Role::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | requires 'eval'; | |||||||||||||||||||||||||||
| 14 | 1 | requires 'define'; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Ref::Util qw( is_plain_scalarref ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # convenience methods here | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | sub implementation { | ||||||||||||||||||||||||||||
| 21 | 0 | ▶ | ref shift; | ||||||||||||||||||||||||||
|
Subroutine
implementation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub is_true { | ||||||||||||||||||||||||||||
| 25 | 1 | ▶ | shift; | ||||||||||||||||||||||||||
|
Subroutine
is_true: called CC=5 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 1 | my ($value) = @_; | |||||||||||||||||||||||||||
| 27 | 1 | ▶ | return !!1 if is_plain_scalarref($value) && $$value == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
Ref::Util::XS::is_plain_scalarref($value) and $$value == 1
MC/DC0%0/2
Ref::Util::XS::is_plain_scalarref($value) and $$value == 1
Ref::Util::XS::is_plain_scalarref($value)
$$value == 1
Truth table33%1/3
A and B
A= Ref::Util::XS::is_plain_scalarref($value)B= $$value == 1
| |||||||||||||||||||||||||||||
| 28 | 1 | require JSON::PP; | |||||||||||||||||||||||||||
| 29 | 1 | ▶ | return !!1 if JSON::PP::is_bool($value) && $value == JSON::PP::true(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
JSON::PP::is_bool($value) and $value == JSON::PP::true()
MC/DC0%0/2
JSON::PP::is_bool($value) and $value == JSON::PP::true()
JSON::PP::is_bool($value)
$value == JSON::PP::true()
Truth table33%1/3
A and B
A= JSON::PP::is_bool($value)B= $value == JSON::PP::true()
| |||||||||||||||||||||||||||||
| 30 | 1 | return !!0; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub is_false { | ||||||||||||||||||||||||||||
| 34 | 1 | ▶ | shift; | ||||||||||||||||||||||||||
|
Subroutine
is_false: called CC=5 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 1 | my ($value) = @_; | |||||||||||||||||||||||||||
| 36 | 1 | ▶ | return !!1 if is_plain_scalarref($value) && $$value == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
Ref::Util::XS::is_plain_scalarref($value) and $$value == 0
MC/DC0%0/2
Ref::Util::XS::is_plain_scalarref($value) and $$value == 0
Ref::Util::XS::is_plain_scalarref($value)
$$value == 0
Truth table33%1/3
A and B
A= Ref::Util::XS::is_plain_scalarref($value)B= $$value == 0
| |||||||||||||||||||||||||||||
| 37 | 1 | require JSON::PP; | |||||||||||||||||||||||||||
| 38 | 1 | ▶ | return !!1 if JSON::PP::is_bool($value) && $value == JSON::PP::false(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
JSON::PP::is_bool($value) and $value == JSON::PP::false()
MC/DC0%0/2
JSON::PP::is_bool($value) and $value == JSON::PP::false()
JSON::PP::is_bool($value)
$value == JSON::PP::false()
Truth table33%1/3
A and B
A= JSON::PP::is_bool($value)B= $value == JSON::PP::false()
| |||||||||||||||||||||||||||||
| 39 | 1 | return !!0; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | sub is_null { | ||||||||||||||||||||||||||||
| 43 | 1 | ▶ | return !defined $_[1]; | ||||||||||||||||||||||||||
|
Subroutine
is_null: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | sub _throw_if_bad_name { | ||||||||||||||||||||||||||||
| 47 | 2 | ▶ | return if $_[1] =~ /\A\w+\z/; | ||||||||||||||||||||||||||
|
Subroutine
_throw_if_bad_name: called CC=2 SCAR=10.5
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | require Carp; | |||||||||||||||||||||||||||
| 49 | 0 | Carp::croak("Bad name: " . ref($_[1])); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | sub _throw_because_bad_value { | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | require Carp; | ||||||||||||||||||||||||||
|
Subroutine
_throw_because_bad_value: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 54 | 0 | Carp::croak("Cannot define values of type " . ref($_[1])); | |||||||||||||||||||||||||||
| 55 | # ref should always be defined because non-ref scalars will be good values | ||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 1 | 1; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | __END__ | ||||||||||||||||||||||||||||