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

filter: Statementstmt 71.0% 27 / 38 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 53.8% 7 / 13 Podpod 100% 3 / 3 totaltotal 52.1% 37 / 71 CC 8 SCAR 25.1
CC
8
Cov
51%
to_hash
30.0
set_margin
20.0
croak
2.0
CRAP 12.2
« blib/lib/CXC/Gnuplot/V0/CoordOffset2D.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Font.pm »
1 package CXC::Gnuplot::V0::Margin;
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';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V0::Margin;
10  
11 1 ▶use builtin 'is_bool', 'true', 'false';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 use CXC::Gnuplot::V0::Util
14 1 -lexical => 'assert_coerce_object',
15 1 ▶ 'clone_object', 'pvalidate', 'to_hash_r', 'render_set';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 use CXC::Gnuplot::V0::Types -lexical => qw(
18 Enum
19 Num
20 PerlBoolFalse
21 SetFormats
22 Tuple
23 signature_for
24 1 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 1 ▶use constant MarginValue => Num | PerlBoolFalse | Tuple [ Enum ['at'], Enum ['screen'], Num ];
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 my sub croak {
29 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
30 0 goto \&Carp::croak;
31 }
32  
33 #<<< no tidy
34 1 field $top :param :reader = undef;
35 1 field $bottom :param :reader = undef;
36 1 field $left :param :reader = undef;
37 1 field $right :param :reader = undef;
38 #>>>
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56 ADJUST {
57 0 ▶ pvalidate( top => MarginValue, \$top );
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 pvalidate( bottom => MarginValue, \$bottom );
59 0 pvalidate( left => MarginValue, \$left );
60 0 pvalidate( right => MarginValue, \$right );
61 }
62  
63  
64  
65  
66  
67  
68 method to_hash {
69  
70 0 ▶ to_hash_r( {
Subroutine to_hash: not called CC=5 SCAR=34.0
Pod documented
Branch: 4 branches
BranchTrueFalseTotal
defined $top ? : 0 0 0
defined $bottom ? : 0 0 0
defined $left ? : 0 0 0
defined $right ? : 0 0 0
71 ( defined $top ? ( top => $top ) : () ),
72 ( defined $bottom ? ( bottom => $bottom ) : () ),
73 ( defined $left ? ( left => $left ) : () ),
74 ( defined $right ? ( right => $right ) : () ),
75 } );
76  
77 }
78  
79  
80  
81  
82  
83 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
84 0 assert_coerce_object( $class, $args );
85 }
86  
87  
88  
89  
90  
91 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
92 0 clone_object( $self, \%args );
93 }
94  
95  
96 ▶my sub set_margin ( $label, $value ) {
Subroutine set_margin: not called CC=4 SCAR=30.0
97  
98 0 ▶ return unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
99 0 ▶ return [ set => $label => is_bool( $value ) && !$value ? () : $value ];
Branch: 1 branch
BranchTrueFalseTotal
builtin::is_bool($value) && !$value ? : 0 0 0
Condition0%0/3
builtin::is_bool($value) and not $value
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::is_bool($value) and not $value
builtin::is_bool($value) not $value
Truth table0%0/3
A and not(B)
A= builtin::is_bool($value)B= not $value
ABresult
0X0
100
111
100 }
101  
102  
103  
104  
105  
106  
107 1 signature_for set => (
108 method => 1,
109 named => [
110 as => SetFormats,
111 { default => 'string' },
112 ],
113 );
114  
115 method set ( $opt ) {
116  
117 ## no critic(NamingConventions::ProhibitAmbiguousNames)
118  
119 my @set = (
120 set_margin( lmargin => $left ),
121 set_margin( rmargin => $right ),
122 set_margin( bmargin => $bottom ),
123 set_margin( tmargin => $top ),
124 );
125  
126 return render_set( \@set, $opt->as );
127 }
128  
129 1 1;
130  
131 #
132 # This file is part of CXC-Gnuplot
133 #
134 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
135 #
136 # This is free software, licensed under:
137 #
138 # The GNU General Public License, Version 3, June 2007
139 #
140  
141 __END__
« blib/lib/CXC/Gnuplot/V0/CoordOffset2D.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Font.pm »