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

filter: Statementstmt 63.2% 31 / 49 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 56.2% 9 / 16 Podpod 100% 4 / 4 totaltotal 45.8% 44 / 96 CC 11 SCAR 25.6
CC
11
Cov
44%
assert_coerce
42.0
to_hash
12.0
__ANON__
6.0
CRAP 13.0
« blib/lib/CXC/Gnuplot/V0/MultiPlot/Title.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/CoordOffset2D.pm »
1 package CXC::Gnuplot::V0::Terminal;
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  
6 1 our $VERSION = 'v0.29.3';
7  
8 class CXC::Gnuplot::V0::Terminal;
9  
10 1 ▶use experimental 'builtin', 'declared_refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use builtin::compat 'load_module', 'true';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶no namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Ref::Util 'is_plain_hashref';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use CXC::Gnuplot::V0::Types -lexical => 'signature_for', 'SetFormats';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use CXC::Gnuplot::V0::Util -lexical => 'clone_object', 'render_opts', 'render_set';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 my sub croak {
21 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
22 0 goto \&Carp::croak;
23 }
24  
25 ## no critic(Subroutines::ProtectPrivateSubs)
26 #<<< no tidy
27 1 field $size :param :reader //= q{};
28 1 field $ext :param :reader = __CLASS__->_DEFAULT_EXT;
29 #>>>
30  
31 # virtual class
32 ADJUST {
33 0 ▶ if ( __CLASS__ eq __PACKAGE__ ) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if (XXX eq __PACKAGE__) 0 0 0
34 0 require Carp;
35 0 Carp::croak( "can't instantiate @{[__CLASS__]}" );
36 }
37 }
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52 ▶sub _DEFAULT_EXT ( $class ) {
Subroutine _DEFAULT_EXT: not called CC=2 SCAR=17.9
53  
54 0 state %ext = (
55 cairolatex => '.tex',
56 canvas => '.js',
57 context => '.tex',
58 dxf => '.dxf',
59 emf => '.emf',
60 epscairo => '.eps',
61 epslatex => '.tex',
62 fig => '.fig',
63 gif => '.gif',
64 jpeg => '.jpg',
65 pbm => '.pbm',
66 pcl5 => '.pcl',
67 pdfcairo => '.pdf',
68 pict2e => '.tex',
69 pngcairo => '.png',
70 postscript => '.ps',
71 pslatex => '.tex',
72 pstricks => '.tex',
73 svg => '.svg',
74 texdraw => '.tex',
75 tikz => '.tex',
76 webp => '.webp',
77 );
78  
79 0 my ( $term ) = $class =~ /([^:]+)$/;
80 0 ▶ return $ext{$term} // q{};
Condition0%0/2
$ext{$term} // ""
l!l
00
MC/DC0%0/1
$ext{$term} // ""
$ext{$term}
Truth table0%0/2
A
A= $ext{$term}
Aresult
11
00
81 }
82  
83  
84  
85  
86  
87 method to_hash {
88 return {
89 0 ▶ ( defined $size ? ( size => $size ) : () ), #
Subroutine to_hash: not called CC=3 SCAR=24.8
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
defined $size ? : 0 0 0
defined $ext ? : 0 0 0
90 ( defined $ext ? ( ext => $ext ) : () ),
91 };
92 }
93  
94  
95  
96  
97  
98 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
99 0 return clone_object( $self, \%args );
100 }
101  
102  
103  
104  
105  
106  
107 ▶sub assert_coerce ( $class, @arg ) {
Subroutine assert_coerce: not called CC=6 SCAR=37.4
Pod documented
108  
109 0 ▶ return $arg[0] if @arg == 1 and $arg[0] isa $class;
Branch: 1 branch
BranchTrueFalseTotal
if @arg == 1 and $arg[0] isa $class 0 0 0
Condition0%0/3
@arg == 1 and $arg[0] isa $class
!ll&&!rl&&r
000
MC/DC0%0/2
@arg == 1 and $arg[0] isa $class
@arg == 1 $arg[0] isa $class
Truth table0%0/3
A and B
A= @arg == 1B= $arg[0] isa $class
ABresult
0X0
100
111
110  
111 0 ▶ my %arg = @arg == 1 ? (
Branch: 2 branches
BranchTrueFalseTotal
@arg == 1 ? : 0 0 0
Ref::Util::XS::is_plain_hashref($arg[0]) ? : 0 0 0
112 is_plain_hashref( $arg[0] )
113 ? $arg[0]->%*
114 : croak( 'unable to coerce ' . ref $arg[0] ) #
115 )
116 : @arg;
117  
118 my $terminal = delete( $arg{terminal} )
119 0 ▶ // croak( 'unspecified terminal type; missing "terminal" attribute' );
Condition0%0/3
delete $arg{"terminal"} // croak("unspecified terminal type; missing \"terminal\" attribute")
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $arg{"terminal"} // croak("unspecified terminal type; missing \"terminal\" attribute")
delete $arg{"terminal"} croak("unspecified terminal type; missing \"terminal\" attribute")
Truth table0%0/3
A // B
A= delete $arg{"terminal"}B= croak("unspecified terminal type; missing \"terminal\" attribute")
ABresult
1X1
011
000
120  
121 0 $class .= q{::} . $terminal;
122  
123 0 load_module( $class );
124 0 return $class->new( %arg );
125 }
126  
127  
128  
129  
130  
131 method opts {
132 0 ▶ return $self->terminal, ( length( $size ) ? [ size => $size ] : () );
Subroutine opts: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
length $size ? : 0 0 0
133 }
134  
135  
136  
137  
138  
139 1 signature_for set => (
140 method => 1,
141 named => [
142 as => SetFormats,
143 { default => 'string' },
144 ],
145 );
146  
147 method set ( $opt ) {
148 return render_set( [ render_opts( [ set => 'terminal' ], $self ) ], $opt->as );
149 }
150  
151 1 1;
152  
153 #
154 # This file is part of CXC-Gnuplot
155 #
156 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
157 #
158 # This is free software, licensed under:
159 #
160 # The GNU General Public License, Version 3, June 2007
161 #
162  
163 __END__
« blib/lib/CXC/Gnuplot/V0/MultiPlot/Title.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/CoordOffset2D.pm »