blib/lib/CXC/Gnuplot/V0/Terminal/cairo.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/TerminalBase.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Terminal/pdfcairo.pm »
1 package CXC::Gnuplot::V0::Terminal::cairo;
2  
3 3 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Feature::Compat::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use experimentals 'builtin';
Subroutine BEGIN: called CC=1 SCAR=2.6
6  
7 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V0::Terminal::cairo : isa(CXC::Gnuplot::V0::Terminal);
10  
11 my sub croak {
12 require Carp;
13 goto \&Carp::croak;
14 }
15  
16 use CXC::Gnuplot::V0::Types -lexical, qw( PositiveNum Enum );
17 use CXC::Gnuplot::V0::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 ADJUST {
62  
63 if ( __CLASS__ eq __PACKAGE__ ) {
64 require Carp;
65 Carp::croak( "can't instantiate @{[__CLASS__]}" );
66 }
67  
68 defined $enhanced
69 and !is_bool( $enhanced )
70 and croak( q{invalid value for "enhanced" parameter: must be bool} );
71  
72 defined $color
73 and !is_bool( $color )
74 and croak q{invalid value for "color" parameter: must be bool};
75  
76 pvalidate( font => Font => \$font );
77  
78 pvalidate( fontscale => PositiveNum, \$fontscale );
79 pvalidate( linewidth => PositiveNum, \$linewidth );
80 pvalidate( linejoin => Enum->of( 'rounded', 'butt', 'square' ), \$linejoin );
81 pvalidate( dashlength => PositiveNum, \$dashlength );
82 }
83  
84  
85  
86  
87  
88 method to_hash {
89  
90 to_hash_r( {
91 $self->SUPER::to_hash->%*,
92 ( defined $enhanced ? ( enhanced => $enhanced ) : () ),
93 ( defined $color ? ( color => $color ) : () ),
94 ( defined $fontscale ? ( fontscale => $fontscale ) : () ),
95 ( defined $linewidth ? ( linewidth => $linewidth ) : () ),
96 ( defined $linejoin ? ( linejoin => $linejoin ) : () ),
97 ( defined $dashlength ? ( dashlength => $dashlength ) : () ),
98 ( defined $font ? ( font => $font ) : () ),
99 } );
100  
101 }
102  
103  
104  
105  
106  
107 sub assert_coerce( $class, $args ) {
108 assert_coerce_object( $class, $args );
109 }
110  
111  
112  
113  
114  
115  
116 method opts {
117  
118 return (
119 $self->SUPER::opts,
120 ( defined $enhanced ? $enhanced ? 'enhanced' : 'noenhanced' : () ),
121 ( defined $color ? $color ? 'color' : 'mono' : () ),
122 ( defined $background ? [ background => $background ] : () ),
123 ( defined $fontscale ? [ fontscale => $fontscale ] : () ),
124 ( defined $linewidth ? [ linewidth => $linewidth ] : () ),
125 ( defined $linejoin ? $linejoin : () ),
126 ( defined $dashlength ? [ dashlength => $dashlength ] : () ),
127 );
128 }
129  
130 1;
131  
132 #
133 # This file is part of CXC-Gnuplot
134 #
135 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
136 #
137 # This is free software, licensed under:
138 #
139 # The GNU General Public License, Version 3, June 2007
140 #
141  
142 __END__
« blib/lib/CXC/Gnuplot/V1/TerminalBase.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Terminal/pdfcairo.pm »