blib/lib/CXC/Gnuplot/V0/MultiPlot/Margins.pm

filter: Statementstmt 63.8% 23 / 36 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 50.0% 6 / 12 Podpod 100% 4 / 4 totaltotal 39.2% 33 / 84 CC 12 SCAR 28.4
CC
12
Cov
37%
__ANON__
30.0
to_hash
30.0
opts
20.0
CRAP 17.0
« blib/lib/CXC/Gnuplot/V0/TermOptions.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Title.pm »
1 package CXC::Gnuplot::V0::MultiPlot::Margins;
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::MultiPlot::Margins;
10  
11 1 ▶use builtin 'is_bool', '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';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use CXC::Gnuplot::V0::Types -lexical => qw( Num );
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 my sub croak {
19 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
20 0 goto \&Carp::croak;
21 }
22  
23 #<<< no tidy
24 1 field $top :param :reader = undef;
25 1 field $bottom :param :reader = undef;
26 1 field $left :param :reader = undef;
27 1 field $right :param :reader = undef;
28 #>>>
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46 ADJUST {
47  
48 0 ▶ croak( 'all margins must be specified' )
Subroutine __ANON__: not called CC=5 SCAR=34.0
Branch: 1 branch
BranchTrueFalseTotal
unless defined $top and defined $bottom and defined $left and defined $right 0 0 0
Condition0%0/9
defined $top and defined $bottom and defined $left and defined $right
!ll&&!rl&&r
000
defined $top and defined $bottom and defined $left
!ll&&!rl&&r
000
defined $top and defined $bottom
!ll&&!rl&&r
000
MC/DC0%0/4
defined $top and defined $bottom and defined $left and defined $right
defined $top defined $bottom defined $left defined $right
Truth table0%0/5
A and B and C and D
A= defined $topB= defined $bottomC= defined $leftD= defined $right
ABCDresult
0XXX0
10XX0
110X0
11100
11111
49 unless defined $top
50 and defined $bottom
51 and defined $left
52 and defined $right;
53  
54 0 pvalidate( top => Num, \$top );
55 0 pvalidate( bottom => Num, \$bottom );
56 0 pvalidate( left => Num, \$left );
57 0 pvalidate( right => Num, \$right );
58 }
59  
60  
61  
62  
63  
64  
65 method to_hash {
66  
67 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
68 ( defined $top ? ( top => $top ) : () ),
69 ( defined $bottom ? ( bottom => $bottom ) : () ),
70 ( defined $left ? ( left => $left ) : () ),
71 ( defined $right ? ( right => $right ) : () ),
72 } );
73  
74 }
75  
76  
77  
78  
79  
80 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
81 0 assert_coerce_object( $class, $args );
82 }
83  
84  
85  
86  
87  
88 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
89 0 clone_object( $self, \%args );
90 }
91  
92  
93  
94  
95  
96  
97 method opts {
98 # only use as many margins as specified.
99 # to specify a specific margin, use the [lrtb]margin commands
100 ## no critic (NamingConventions::ProhibitAmbiguousNames)
101 0 ▶ my @margins = ( $left, $right, $bottom, $top );
Subroutine opts: not called CC=4 SCAR=30.0
Pod documented
102 0 ▶ pop @margins while @margins && !defined $margins[-1];
Branch: 1 branch
BranchTrueFalseTotal
@margins and not defined $margins[-1] and do { pop @margins } 0 0 0
Condition0%0/3
@margins and not defined $margins[-1]
!ll&&!rl&&r
000
MC/DC0%0/2
@margins and not defined $margins[-1]
@margins not defined $margins[-1]
Truth table0%0/3
A and not(B)
A= @marginsB= not defined $margins[-1]
ABresult
0X0
100
111
103  
104 0 ▶ return ( @margins ? join( q{,}, @margins ) : () );
Branch: 1 branch
BranchTrueFalseTotal
@margins ? : 0 0 0
105 }
106  
107 1 1;
108  
109 #
110 # This file is part of CXC-Gnuplot
111 #
112 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
113 #
114 # This is free software, licensed under:
115 #
116 # The GNU General Public License, Version 3, June 2007
117 #
118  
119 __END__
« blib/lib/CXC/Gnuplot/V0/TermOptions.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Title.pm »