blib/lib/CXC/Gnuplot/V0/LiteralDataValue.pm

filter: Statementstmt 90.7% 39 / 43 Branchbran 60.0% 6 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 12 / 15 Podpod 100% 3 / 3 totaltotal 84.5% 60 / 71 CC 6 SCAR 7.3
CC
6
Cov
85%
assert_coerce
4.3
__ANON__
3.0
croak
2.0
CRAP 2.1
« blib/lib/CXC/Gnuplot/V1/Terminal.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Types.pm »
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
BranchTrueFalseTotal
Ref::Util::XS::is_ref($value) and croak "value must be a scalar" 0 147 147
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
BranchTrueFalseTotal
&looks_like_number($value) ? : 142 5 147
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
BranchTrueFalseTotal
if (@arg == 1) 142 0 142
56 142 my $value = pop @arg;
57 142 ▶ return $value if $value isa $class;
Branch: 1 branch
BranchTrueFalseTotal
if $value isa $class 0 142 142
58  
59 142 ▶ @arg = is_hashref $value ? $value->%* : ( value => $value );
Branch: 1 branch
BranchTrueFalseTotal
Ref::Util::XS::is_hashref($value) ? : 0 142 142
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__
« blib/lib/CXC/Gnuplot/V1/Terminal.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Types.pm »