blib/lib/CXC/Gnuplot/V1/MultiPlot/Title.pm

filter: Statementstmt 75.0% 6 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 81.8% 9 / 11 CC 1 SCAR 0.9
CC
1
Cov
75%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/CXC/Gnuplot/V1/MultiPlot.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/Range.pm »
1 package CXC::Gnuplot::V1::MultiPlot::Title;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental 'builtin';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Object::Pad 0.821;
Subroutine BEGIN: called CC=1 SCAR=2.6
6  
7 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V1::MultiPlot::Title : isa(CXC::Gnuplot::V1::Base)
10 does( CXC::Gnuplot::V1::Role::Clone );
11  
12 use CXC::Gnuplot::V1::Types -lexical => qw(
13 Enum is_Str
14 );
15 use CXC::Gnuplot::V1::Util
16 -lexical => 'maybe_quote',
17 'pvalidate', 'to_hash_r', 'render_opts';
18  
19 no namespace::clean;
20  
21 use Ref::Util qw( is_ref );
22  
23 use namespace::clean;
24  
25 use builtin 'is_bool';
26  
27 my sub croak {
28 require Carp;
29 goto \&Carp::croak;
30 }
31  
32 #<<< no tidy
33 field $text :param :reader;
34 field $font :param :reader = undef;
35 field $enhanced :param :reader = undef;
36 field $justify :param :reader = undef;
37 field $textcolor :param :reader = undef;
38 #>>>
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59 ADJUST {
60  
61 pvalidate( font => Font => \$font );
62  
63 pvalidate( textcolor => ColorSpec => \$textcolor );
64  
65 # {{no}enhanced}
66 # $enhanced => Bool
67 defined $enhanced
68 and !is_bool( $enhanced )
69 and croak( q{invalid value for "enhanced" parameter; must be bool} );
70  
71 # $justify => [ left, center, right ]
72 pvalidate( justify => Enum->of( 'left', 'right', 'center' ), \$justify );
73 }
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89 method BUILDARGS : common (@args ) {
90 return ( text => $args[0] ) if @args == 1 && !is_ref( $args[0] );
91 return $class->SUPER::BUILDARGS( @args );
92 }
93  
94  
95  
96  
97  
98  
99  
100 method to_hash {
101  
102 to_hash_r( {
103 ( defined $text ? ( text => $text ) : () ),
104 ( defined $font ? ( font => $font ) : () ),
105 ( defined $enhanced ? ( enhanced => $enhanced ) : () ),
106 ( defined $textcolor ? ( textcolor => $textcolor ) : () ),
107 ( defined $justify ? ( justify => $justify ) : () ),
108 } );
109  
110 }
111  
112  
113  
114  
115  
116 method opts {
117  
118 my @opts;
119  
120 push @opts, maybe_quote( $text );
121  
122 push @opts, render_opts( font => $font );
123  
124 defined $enhanced
125 and push @opts, $enhanced ? 'enhanced' : 'noenhaced';
126  
127 defined $justify
128 and push @opts, $justify;
129  
130 push @opts, render_opts( textcolor => $textcolor );
131  
132 return @opts;
133 }
134  
135  
136 1;
137  
138 #
139 # This file is part of CXC-Gnuplot
140 #
141 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
142 #
143 # This is free software, licensed under:
144 #
145 # The GNU General Public License, Version 3, June 2007
146 #
147  
148 __END__
« blib/lib/CXC/Gnuplot/V1/MultiPlot.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/Range.pm »