blib/lib/CXC/Gnuplot/V1/Terminal/cairo.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/TermOptions.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/Terminal/pdfcairo.pm »
1 package CXC::Gnuplot::V1::Terminal::cairo;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Object::Pad 0.821;
Subroutine BEGIN: called CC=1 SCAR=2.6
5 use experimentals 'builtin';
6  
7 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V1::Terminal::cairo : isa(CXC::Gnuplot::V1::TerminalBase);
10  
11 my sub croak {
12 require Carp;
13 goto \&Carp::croak;
14 }
15  
16 use CXC::Gnuplot::V1::Types -lexical, qw( PositiveNum Enum );
17 use CXC::Gnuplot::V1::Util -lexical => 'pvalidate', 'to_hash_r';
18  
19 use builtin 'is_bool';
20  
21 #<<< no tidy
22 field $enhanced :param :reader = undef;
23 field $color :param :reader = undef;
24 field $background :param :reader = undef;
25 field $font :param :reader = undef;
26 field $fontscale :param :reader = undef;
27 field $linewidth :param :reader = undef;
28 field $linejoin :param :reader = undef;
29 field $dashlength :param :reader = undef;
30 #>>>
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63 ADJUST {
64  
65 if ( __CLASS__ eq __PACKAGE__ ) {
66 require Carp;
67 Carp::croak( "can't instantiate @{[__CLASS__]}" );
68 }
69  
70 defined $enhanced
71 and !is_bool( $enhanced )
72 and croak( q{invalid value for "enhanced" parameter: must be bool} );
73  
74 defined $color
75 and !is_bool( $color )
76 and croak q{invalid value for "color" parameter: must be bool};
77  
78 pvalidate( font => Font => \$font );
79  
80 pvalidate( fontscale => PositiveNum, \$fontscale );
81 pvalidate( linewidth => PositiveNum, \$linewidth );
82 pvalidate( linejoin => Enum->of( 'rounded', 'butt', 'square' ), \$linejoin );
83 pvalidate( dashlength => PositiveNum, \$dashlength );
84 }
85  
86  
87  
88  
89  
90  
91  
92  
93 method to_hash {
94  
95 to_hash_r( {
96 $self->SUPER::to_hash->%*,
97 ( defined $enhanced ? ( enhanced => $enhanced ) : () ),
98 ( defined $color ? ( color => $color ) : () ),
99 ( defined $fontscale ? ( fontscale => $fontscale ) : () ),
100 ( defined $linewidth ? ( linewidth => $linewidth ) : () ),
101 ( defined $linejoin ? ( linejoin => $linejoin ) : () ),
102 ( defined $dashlength ? ( dashlength => $dashlength ) : () ),
103 ( defined $font ? ( font => $font ) : () ),
104 } );
105  
106 }
107  
108  
109  
110  
111  
112 method opts {
113  
114 return (
115 $self->SUPER::opts,
116 ( defined $enhanced ? $enhanced ? 'enhanced' : 'noenhanced' : () ),
117 ( defined $color ? $color ? 'color' : 'mono' : () ),
118 ( defined $background ? [ background => $background ] : () ),
119 ( defined $fontscale ? [ fontscale => $fontscale ] : () ),
120 ( defined $linewidth ? [ linewidth => $linewidth ] : () ),
121 ( defined $linejoin ? $linejoin : () ),
122 ( defined $dashlength ? [ dashlength => $dashlength ] : () ),
123 );
124 }
125  
126 1;
127  
128 #
129 # This file is part of CXC-Gnuplot
130 #
131 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
132 #
133 # This is free software, licensed under:
134 #
135 # The GNU General Public License, Version 3, June 2007
136 #
137  
138 __END__
« blib/lib/CXC/Gnuplot/V1/TermOptions.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/Terminal/pdfcairo.pm »