| 1 | package CXC::Gnuplot::V0::LiteralDataValue; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: a literal data value, either numeric or a date | ||||||||||
| 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 | |||||||||||
| 11 | class CXC::Gnuplot::V0::LiteralDataValue; | ||||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | no namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 2 | ▶ | use Scalar::Util 'looks_like_number'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 2 | ▶ | use Ref::Util 'is_hashref', 'is_ref'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 2 | ▶ | use experimental 'builtin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 2 | ▶ | use builtin 'true'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | 2 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 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
| |||||||||||
| 23 | |||||||||||
| 24 | my sub croak { | ||||||||||
| 25 | 0 | ▶ | require Carp; | ||||||||
|
Subroutine
croak: not called CC=1 SCAR=6.9
| |||||||||||
| 26 | 0 | goto \&Carp::croak; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | 2 | field $value : param : reader; | |||||||||
| 34 | 2 | field $string; | |||||||||
| 35 | |||||||||||
| 36 | ADJUST { | ||||||||||
| 37 | |||||||||||
| 38 | 147 | ▶ | is_ref( $value ) | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
Branch: 1 branch
| |||||||||||
| 39 | and croak( 'value must be a scalar' ); | ||||||||||
| 40 | |||||||||||
| 41 | 147 | require B; | |||||||||
| 42 | 147 | ▶ | $string = looks_like_number( $value ) ? $value : B::cstring( $value ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | |||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | |||||||||||
| 51 | |||||||||||
| 52 | |||||||||||
| 53 | ▶ | sub assert_coerce ( $class, @arg ) { | |||||||||
|
Subroutine
assert_coerce: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||
| 54 | |||||||||||
| 55 | 142 | ▶ | if ( @arg == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 142 | my $value = pop @arg; | |||||||||
| 57 | 142 | ▶ | return $value if $value isa $class; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | |||||||||||
| 59 | 142 | ▶ | @arg = is_hashref $value ? $value->%* : ( value => $value ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | 142 | return $class->new( @arg ); | |||||||||
| 64 | |||||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | |||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | method to_hash { | ||||||||||
| 71 | 0 | ▶ | { value => $value } | ||||||||
|
Subroutine
to_hash: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | |||||||||||
| 75 | |||||||||||
| 76 | |||||||||||
| 77 | |||||||||||
| 78 | |||||||||||
| 79 | |||||||||||
| 80 | |||||||||||
| 81 | |||||||||||
| 82 | |||||||||||
| 83 | |||||||||||
| 84 | method stringify { | ||||||||||
| 85 | 190 | ▶ | return $string; | ||||||||
|
Subroutine
stringify: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | |||||||||||
| 89 | 2 | 1; | |||||||||
| 90 | |||||||||||
| 91 | __END__ | ||||||||||