| 1 | package CXC::Gnuplot::V0::CoordValue; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # ABSTRACT: A Coordinate Value, with optional coordinate system | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use v5.38; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Feature::Compat::Class; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | our $VERSION = 'v0.29.3'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | class CXC::Gnuplot::V0::CoordValue; | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | no namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use CXC::Gnuplot::V0::Types -lexical => 'CoordSys', 'CoordValue'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | use CXC::Gnuplot::V0::Util | ||||||||||||||||||||||||||||
| 16 | 2 | -lexical => 'assert_coerce_object', | |||||||||||||||||||||||||||
| 17 | 'pvalidate', | ||||||||||||||||||||||||||||
| 18 | 'to_hash_r', | ||||||||||||||||||||||||||||
| 19 | 2 | ▶ | ; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use experimental 'builtin'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use builtin 'true'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use Ref::Util 'is_plain_hashref', 'is_plain_arrayref', 'is_ref'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 2 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 2 | ▶ | use overload q{""} => \&stringify, bool => sub { true }, fallback => true; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | #<<< no tidy | ||||||||||||||||||||||||||||
| 36 | 2 | field $value :param :reader; | |||||||||||||||||||||||||||
| 37 | 2 | field $coordsys :param :reader = undef; | |||||||||||||||||||||||||||
| 38 | 2 | field $string; | |||||||||||||||||||||||||||
| 39 | #>>> | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | ADJUST { | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 86 | ▶ | pvalidate( value => LiteralDataValue => \$value ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 44 | 86 | pvalidate( coordsys => CoordSys, \$coordsys ); | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 86 | ▶ | $string = defined( $coordsys ) ? "$coordsys $value" : $value . q{}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | ▶ | sub coerce_attrs ( $class, @arg ) { | |||||||||||||||||||||||||||
|
Subroutine
coerce_attrs: called CC=6 SCAR=18.7
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 86 | ▶ | if ( @arg == 1 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 86 | my $value = $arg[0]; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 86 | ▶ | return $value if is_plain_hashref( $value ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 82 | ▶ | return { coordsys => $value->[0], value => $value->[1] } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
Ref::Util::XS::is_plain_arrayref($value) and @$value == 2
MC/DC50%1/2
Ref::Util::XS::is_plain_arrayref($value) and @$value == 2
Ref::Util::XS::is_plain_arrayref($value)
@$value == 2
Truth table66%2/3
A and B
A= Ref::Util::XS::is_plain_arrayref($value)B= @$value == 2
| |||||||||||||||||||||||||||||
| 65 | if is_plain_arrayref( $value ) && $value->@* == 2; | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 60 | ▶ | return { value => $value } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | if !is_ref( $value ); | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | return undef; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | ▶ | sub assert_coerce( $class, @args ) { | |||||||||||||||||||||||||||
|
Subroutine
assert_coerce: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | 86 | assert_coerce_object( $class, @args ); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | method to_hash { | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | to_hash_r( { | ||||||||||||||||||||||||||
|
Subroutine
to_hash: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | value => $value->value, | ||||||||||||||||||||||||||||
| 92 | ( defined $coordsys ? ( coordsys => $coordsys ) : () ), | ||||||||||||||||||||||||||||
| 93 | } ); | ||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | method stringify { | ||||||||||||||||||||||||||||
| 105 | 0 | ▶ | return $string; | ||||||||||||||||||||||||||
|
Subroutine
stringify: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 2 | 1; | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | __END__ | ||||||||||||||||||||||||||||