blib/lib/CXC/Gnuplot/V1/CoordValue.pm

filter: Statementstmt 60.0% 3 / 5 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 71.4% 5 / 7 CC 1 SCAR 1.4
CC
1
Cov
60%
BEGIN
1.3
BEGIN
1.0
CRAP 1.1
« blib/lib/CXC/Gnuplot/V1/Bound/TimeDate.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/LiteralDataValue.pm »
1 package CXC::Gnuplot::V1::CoordValue;
2  
3 # ABSTRACT: A Coordinate Value, with optional coordinate system
4  
5 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Object::Pad 0.821;
Subroutine BEGIN: called CC=1 SCAR=2.6
7  
8 our $VERSION = 'v0.29.3';
9  
10 class CXC::Gnuplot::V1::CoordValue : isa(CXC::Gnuplot::V1::Base)
11 does( CXC::Gnuplot::V1::Role::Clone );
12  
13 no namespace::clean;
14  
15 use CXC::Gnuplot::V1::Types -lexical => 'CoordSys', 'CoordValue';
16 use CXC::Gnuplot::V1::Util
17 -lexical => 'pvalidate',
18 'to_hash_r',
19 ;
20  
21 use experimental 'builtin';
22 use builtin 'true';
23 use Ref::Util 'is_plain_hashref', 'is_plain_arrayref', 'is_ref';
24  
25 use namespace::clean;
26  
27 use overload q{""} => \&stringify, bool => sub { true }, fallback => true;
28  
29  
30  
31  
32  
33  
34  
35 #<<< no tidy
36 field $value :param :reader;
37 field $coordsys :param :reader = undef;
38 field $string;
39 #>>>
40  
41 ADJUST {
42  
43 pvalidate( value => LiteralDataValue => \$value );
44 pvalidate( coordsys => CoordSys, \$coordsys );
45  
46 $string = defined( $coordsys ) ? "$coordsys $value" : $value . q{};
47 }
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66 method BUILDARGS : common (@args ) {
67 return ( value => $args[0] ) if @args == 1 && !is_ref( $args[0] );
68 return ( coordsys => $args[0][0], value => $args[0][1] )
69 if @args == 1 && is_plain_arrayref( $args[0] ) && $args[0]->@* == 2;
70 return $class->SUPER::BUILDARGS( @args );
71 }
72  
73  
74  
75  
76  
77  
78  
79  
80 method to_hash {
81  
82 to_hash_r( {
83 value => $value->value,
84 ( defined $coordsys ? ( coordsys => $coordsys ) : () ),
85 } );
86 }
87  
88  
89  
90  
91  
92  
93  
94  
95  
96 method stringify {
97 return $string;
98 }
99  
100  
101 1;
102  
103 __END__
« blib/lib/CXC/Gnuplot/V1/Bound/TimeDate.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/LiteralDataValue.pm »