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

filter: Statementstmt 63.4% 26 / 41 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 6 / 12 Podpod 100% 3 / 3 totaltotal 44.3% 35 / 79 CC 12 SCAR 31.2
CC
12
Cov
42%
to_hash
56.0
set_attr
20.0
__ANON__
12.0
CRAP 22.6
« blib/lib/CXC/Gnuplot/V0/Timestamp.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/MultiPlot/Margins.pm »
1 package CXC::Gnuplot::V0::TermOptions;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Feature::Compat::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use experimental 'builtin', 'declared_refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V0::TermOptions;
10  
11 use CXC::Gnuplot::V0::Util
12 1 -lexical => 'assert_coerce_object',
13 1 ▶ 'clone_object', 'pvalidate', 'render_opts', 'render_set';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use CXC::Gnuplot::V0::Types -lexical, qw( PositiveNum SetFormats signature_for );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use builtin::compat 'blessed', 'is_bool', 'true';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 my sub croak {
18 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
19 0 goto \&Carp::croak;
20 }
21  
22 #<<< no tidy
23 1 field $enhanced :param :reader = undef;
24 1 field $font :param :reader = undef;
25 1 field $fontscale :param :reader = undef;
26 1 field $linewidth :param :reader = undef;
27 1 field $dashlength :param :reader = undef;
28 1 field $pointscale :param :reader = undef;
29 #>>>
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52 ADJUST {
53 0 ▶ defined $enhanced
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
defined $enhanced and not builtin::is_bool($enhanced) and croak "invalid value for \"enhanced\" parameter: must be bool" 0 0 0
Condition0%0/3
defined $enhanced and not builtin::is_bool($enhanced)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $enhanced and not builtin::is_bool($enhanced)
defined $enhanced not builtin::is_bool($enhanced)
Truth table0%0/3
A and not(B)
A= defined $enhancedB= not builtin::is_bool($enhanced)
ABresult
0X0
100
111
54 and !is_bool( $enhanced )
55 and croak( q{invalid value for "enhanced" parameter: must be bool} );
56  
57 0 pvalidate( font => Font => \$font );
58 0 pvalidate( fontscale => PositiveNum, \$fontscale );
59 0 pvalidate( linewidth => PositiveNum, \$linewidth );
60 0 pvalidate( dashlength => PositiveNum, \$dashlength );
61 0 pvalidate( pointscale => PositiveNum, \$pointscale );
62 }
63  
64  
65  
66  
67  
68  
69 method to_hash {
70 return {
71 0 ▶ ( defined $enhanced ? ( enhanced => $enhanced ) : () ),
Subroutine to_hash: not called CC=7 SCAR=40.3
Pod documented
Branch: 6 branches
BranchTrueFalseTotal
defined $enhanced ? : 0 0 0
defined $font ? : 0 0 0
defined $fontscale ? : 0 0 0
defined $linewidth ? : 0 0 0
defined $dashlength ? : 0 0 0
defined $pointscale ? : 0 0 0
72 ( defined $font ? ( font => $font ) : () ),
73 ( defined $fontscale ? ( fontscale => $fontscale ) : () ),
74 ( defined $linewidth ? ( linewidth => $linewidth ) : () ),
75 ( defined $dashlength ? ( dashlength => $dashlength ) : () ),
76 ( defined $pointscale ? ( pointscale => $pointscale ) : () ),
77 };
78 }
79  
80  
81  
82  
83  
84 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
85 0 return clone_object( $self, \%args );
86 }
87  
88  
89  
90  
91  
92  
93 ▶sub assert_coerce ( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
94 0 assert_coerce_object( $class, $args );
95 }
96  
97 0 ▶my sub set_attr ( $label, $value, $set_opts = {} ) {
Subroutine set_attr: not called CC=4 SCAR=30.0
98 0 my \%set_opts = $set_opts;
99 0 ▶ return () unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
100 0 ▶ return blessed( $value )
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($value) ? : 0 0 0
101 ? $value->set( %set_opts )
102 : [ set => termoption => $label => $value ];
103 }
104  
105  
106  
107  
108  
109 1 signature_for set => (
110 method => 1,
111 named => [
112 as => SetFormats,
113 { default => 'string' },
114 ],
115 );
116  
117 method set ( $opt ) {
118 ## no critic(NamingConventions::ProhibitAmbiguousNames)
119  
120 my %format = ( as => $opt->as );
121  
122 ## no critic (NamingConventions::ProhibitAmbiguousNames)
123 my @set;
124  
125 defined $enhanced
126 and push @set, [ set => termoption => $enhanced ? 'enhanced' : 'noenhanced' ];
127  
128 push @set,
129 set_attr( fontscale => $fontscale, \%format ),
130 set_attr( linewidth => $linewidth, \%format ),
131 set_attr( dashlength => $dashlength, \%format ),
132 set_attr( pointscale => $pointscale, \%format ),
133 ;
134  
135 push @set, render_opts( [qw( set termoption font )], $font );
136  
137 return render_set( \@set, $opt->as );
138 }
139  
140 1 1;
141  
142 #
143 # This file is part of CXC-Gnuplot
144 #
145 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
146 #
147 # This is free software, licensed under:
148 #
149 # The GNU General Public License, Version 3, June 2007
150 #
151  
152 __END__
« blib/lib/CXC/Gnuplot/V0/Timestamp.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/MultiPlot/Margins.pm »