blib/lib/Gnuplot/Builder/Script.pm

filter: Statementstmt 97.0% 232 / 239 Branchbran 83.7% 67 / 80 Conditioncond 73.3% 11 / 15 MC/DCmcdc 60.0% 6 / 10 Subroutinesub 98.1% 53 / 54 Podpod 96.3% 26 / 27 totaltotal 92.9% 395 / 425 SCAR 40.1
CC
54
Cov
93%
_create_statement
6.0
__ANON__
6.0
_collect_dataset_params
5.2
CRAP 55.1
« blib/lib/Gnuplot/Builder/Process.pm ↑ Summary blib/lib/Gnuplot/Builder/PrototypedData.pm »
1 package Gnuplot::Builder::Script;
2 37 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 37 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 37 ▶use Gnuplot::Builder::PrototypedData;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 37 ▶use Gnuplot::Builder::Util qw(quote_gnuplot_str);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 37 ▶use Gnuplot::Builder::Process;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 37 ▶use Scalar::Util qw(weaken blessed refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 37 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 37 ▶use overload '""' => "to_string";
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub new {
12 1174 ▶ my ($class, @set_args) = @_;
Subroutine new: called CC=2 SCAR=6.9
Pod documented
13 1174 my $self = bless {
14 pdata => undef,
15 parent => undef,
16 };
17 1174 $self->_init_pdata();
18 1174 ▶ if(@set_args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@set_args) 18 1156 1174
19 18 $self->set(@set_args);
20 }
21 1174 return $self;
22 }
23  
24 sub _init_pdata {
25 1174 ▶ my ($self) = @_;
Subroutine _init_pdata: called CC=1 SCAR=0.0
26 1174 weaken $self;
27 $self->{pdata} = Gnuplot::Builder::PrototypedData->new(
28 entry_evaluator => sub {
29 41 ▶ my ($key, $value_code) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
30 41 ▶ if(defined($key)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $key) { } 38 3 41
31 38 return $value_code->($self, substr($key, 1));
32 }else {
33 3 return $value_code->($self);
34 }
35 }
36 1174 );
37 }
38  
39 sub add {
40 15 ▶ my ($self, @sentences) = @_;
Subroutine add: called CC=2 SCAR=6.9
Pod documented
41 15 foreach my $sentence (@sentences) {
42 20 $self->{pdata}->add_entry($sentence);
43 }
44 15 return $self;
45 }
46  
47 sub _set_entry {
48 111 ▶ my ($self, $prefix, $quote, @pairs) = @_;
Subroutine _set_entry: called CC=1 SCAR=0.0
49 $self->{pdata}->set_entry(
50 111 entries => \@pairs,
51 key_prefix => $prefix,
52 quote => $quote,
53 );
54 111 return $self;
55 }
56  
57 sub set {
58 75 ▶ my ($self, @pairs) = @_;
Subroutine set: called CC=1 SCAR=0.0
Pod documented
59 75 return $self->_set_entry("o", 0, @pairs);
60 }
61  
62 37 *set_option = *set;
63  
64 sub setq {
65 21 ▶ my ($self, @pairs) = @_;
Subroutine setq: called CC=1 SCAR=0.0
Pod documented
66 21 return $self->_set_entry("o", 1, @pairs);
67 }
68  
69 37 *setq_option = *setq;
70  
71 sub unset {
72 2 ▶ my ($self, @names) = @_;
Subroutine unset: called CC=1 SCAR=0.0
Pod documented
73 2 return $self->set(map { $_ => undef } @names);
74 }
75  
76 sub _get_entry {
77 75 ▶ my ($self, $prefix, $name) = @_;
Subroutine _get_entry: called CC=2 SCAR=7.1
78 75 ▶ croak "name cannot be undef" if not defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 75 75
79 75 return $self->{pdata}->get_resolved_entry("$prefix$name");
80 }
81  
82 sub get_option {
83 62 ▶ my ($self, $name) = @_;
Subroutine get_option: called CC=1 SCAR=0.0
Pod documented
84 62 return $self->_get_entry("o", $name);
85 }
86  
87 sub _delete_entry {
88 9 ▶ my ($self, $prefix, @names) = @_;
Subroutine _delete_entry: called CC=3 SCAR=11.1
89 9 foreach my $name (@names) {
90 11 ▶ croak "name cannot be undef" if not defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 11 11
91 11 $self->{pdata}->delete_entry("$prefix$name");
92 }
93 9 return $self;
94 }
95  
96 sub delete_option {
97 5 ▶ my ($self, @names) = @_;
Subroutine delete_option: called CC=1 SCAR=0.0
Pod documented
98 5 return $self->_delete_entry("o", @names);
99 }
100  
101 sub _create_statement {
102 258 ▶ my ($raw_key, $value) = @_;
Subroutine _create_statement: called CC=6 SCAR=18.0
103 258 ▶ return $value if !defined $raw_key;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $raw_key 45 213 258
104 213 my ($prefix, $name) = (substr($raw_key, 0, 1), substr($raw_key, 1));
105 213 my @words = ();
106 213 ▶ if($prefix eq "o") {
Branch: 2 branches
BranchTrueFalseTotal
if ($prefix eq 'o') { } 177 36 213
elsif ($prefix eq 'd') { } 36 0 36
107 177 ▶ @words = defined($value) ? ("set", $name, $value) : ("unset", $name);
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 158 19 177
108 }elsif($prefix eq "d") {
109 36 ▶ @words = defined($value) ? ($name, "=", $value) : ("undefine", $name);
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 27 9 36
110 }else {
111 0 confess "Unknown key prefix: $prefix";
112 }
113 213 return join(" ", grep { "$_" ne "" } @words);
114 }
115  
116 sub to_string {
117 231 ▶ my ($self) = @_;
Subroutine to_string: called CC=1 SCAR=0.0
Pod documented
118 231 my $result = "";
119 $self->{pdata}->each_resolved_entry(sub {
120 246 ▶ my ($raw_key, $values) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.0
121 246 foreach my $value (@$values) {
122 258 my $statement = _create_statement($raw_key, $value);
123 258 $result .= $statement;
124 258 ▶ $result .= "\n" if $statement !~ /\n$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $statement =~ /\n$/ 252 6 258
125 }
126 231 });
127 231 return $result;
128 }
129  
130 sub define {
131 15 ▶ my ($self, @pairs) = @_;
Subroutine define: called CC=1 SCAR=0.0
Pod documented
132 15 return $self->_set_entry("d", 0, @pairs);
133 }
134  
135 37 *set_definition = *define;
136  
137 sub undefine {
138 1 ▶ my ($self, @names) = @_;
Subroutine undefine: called CC=1 SCAR=0.0
Pod documented
139 1 return $self->define(map { $_ => undef } @names);
140 }
141  
142 sub get_definition {
143 13 ▶ my ($self, $name) = @_;
Subroutine get_definition: called CC=1 SCAR=0.0
Pod documented
144 13 return $self->_get_entry("d", $name);
145 }
146  
147 sub delete_definition {
148 4 ▶ my ($self, @names) = @_;
Subroutine delete_definition: called CC=1 SCAR=0.0
Pod documented
149 4 return $self->_delete_entry("d", @names);
150 }
151  
152 sub set_parent {
153 1011 ▶ my ($self, $parent) = @_;
Subroutine set_parent: called CC=4 SCAR=14.4
Pod documented
154 1011 ▶ if(!defined($parent)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parent) 1 1010 1011
155 1 $self->{parent} = undef;
156 1 $self->{pdata}->set_parent(undef);
157 1 return $self;
158 }
159 1010 ▶ if(!blessed($parent) || !$parent->isa("Gnuplot::Builder::Script")) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($parent) and $parent->isa("Gnuplot::Builder::Script")) 0 1010 1010
Condition33%1/3
builtin::blessed($parent) and $parent->isa("Gnuplot::Builder::Script")
!ll&&!rl&&r
001010
MC/DC0%0/2
builtin::blessed($parent) and $parent->isa("Gnuplot::Builder::Script")
builtin::blessed($parent) $parent->isa("Gnuplot::Builder::Script")
Truth table33%1/3
A and B
A= builtin::blessed($parent)B= $parent->isa("Gnuplot::Builder::Script")
ABresult
0X0
100
111
160 0 croak "parent must be a Gnuplot::Builder::Script"
161 }
162 1010 $self->{parent} = $parent;
163 1010 $self->{pdata}->set_parent($parent->{pdata});
164 1010 return $self;
165 }
166  
167 5 ▶sub get_parent { return $_[0]->{parent} }
Subroutine get_parent: called CC=1 SCAR=0.0
Pod documented
168  
169 37 *parent = *get_parent;
170  
171 sub new_child {
172 1008 ▶ my ($self) = @_;
Subroutine new_child: called CC=1 SCAR=0.0
Pod documented
173 1008 return Gnuplot::Builder::Script->new->set_parent($self);
174 }
175  
176 sub _collect_dataset_params {
177 74 ▶ my ($dataset_arrayref) = @_;
Subroutine _collect_dataset_params: called CC=5 SCAR=16.5
178 74 my @params_str = ();
179 74 my @dataset_objects = ();
180 74 foreach my $dataset (@$dataset_arrayref) {
181 89 my $ref = ref($dataset);
182 89 ▶ if(!$ref) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $ref) { } 70 19 89
183 70 push(@params_str, $dataset);
184 }else {
185 19 ▶ if(!$dataset->can("params_string") || !$dataset->can("write_data_to")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dataset->can("params_string") and $dataset->can("write_data_to")) 0 19 19
Condition33%1/3
$dataset->can("params_string") and $dataset->can("write_data_to")
!ll&&!rl&&r
0019
MC/DC0%0/2
$dataset->can("params_string") and $dataset->can("write_data_to")
$dataset->can("params_string") $dataset->can("write_data_to")
Truth table33%1/3
A and B
A= $dataset->can("params_string")B= $dataset->can("write_data_to")
ABresult
0X0
100
111
186 0 croak "You cannot use $ref object as a dataset.";
187 }
188 19 my ($param_str) = $dataset->params_string();
189 19 push(@params_str, $param_str);
190 19 push(@dataset_objects, $dataset);
191 }
192 }
193 74 return (\@params_str, \@dataset_objects);
194 }
195  
196 sub _wrap_writer_to_detect_empty_data {
197 103 ▶ my ($writer) = @_;
Subroutine _wrap_writer_to_detect_empty_data: called CC=1 SCAR=0.0
198 103 my $ended_with_newline = 0;
199 103 my $data_written = 0;
200 my $wrapped_writer = sub {
201 37 ▶ my @nonempty_data = grep { defined($_) && $_ ne "" } @_;
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
defined $_ and $_ ne "" 33 2 35
202 37 ▶ return if !@nonempty_data;
Branch: 1 branch
BranchTrueFalseTotal
unless @nonempty_data 7 30 37
203 30 $data_written = 1;
204 30 $ended_with_newline = ($nonempty_data[-1] =~ /\n$/);
205 30 $writer->(join("", @nonempty_data));
206 103 };
207 103 return ($wrapped_writer, \$data_written, \$ended_with_newline);
208 }
209  
210 sub _write_inline_data {
211 74 ▶ my ($writer, $dataset_objects_arrayref) = @_;
Subroutine _write_inline_data: called CC=4 SCAR=13.9
212 74 my ($wrapped_writer, $data_written_ref, $ended_with_newline_ref) =
213 _wrap_writer_to_detect_empty_data($writer);
214 74 foreach my $dataset (@$dataset_objects_arrayref) {
215 19 $$data_written_ref = $$ended_with_newline_ref = 0;
216 19 $dataset->write_data_to($wrapped_writer);
217 19 ▶ next if !$$data_written_ref;
Branch: 1 branch
BranchTrueFalseTotal
unless $$data_written_ref 8 11 19
218 11 ▶ $writer->("\n") if !$$ended_with_newline_ref;
Branch: 1 branch
BranchTrueFalseTotal
unless $$ended_with_newline_ref 5 6 11
219 11 $writer->("e\n");
220 }
221 }
222  
223 sub _wrap_commands_with_output {
224 156 ▶ my ($commands_ref, $output_filename) = @_;
Subroutine _wrap_commands_with_output: called CC=2 SCAR=6.9
225 156 ▶ if(defined($output_filename)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $output_filename) 12 144 156
226 12 unshift @$commands_ref, "set output " . quote_gnuplot_str($output_filename);
227 12 push @$commands_ref, "set output";
228 }
229 }
230  
231 sub _draw_with {
232 74 ▶ my ($self, %args) = @_;
Subroutine _draw_with: called CC=4 SCAR=13.9
233 74 my $plot_command = $args{command};
234 74 my $dataset = $args{dataset};
235 74 ▶ croak "dataset parameter is mandatory" if not defined $dataset;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dataset 0 74 74
236 74 ▶ if(ref($dataset) ne "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $dataset ne "ARRAY") 19 55 74
237 19 $dataset = [$dataset];
238 }
239 74 ▶ croak "at least one dataset is required" if !@$dataset;
Branch: 1 branch
BranchTrueFalseTotal
unless @$dataset 0 74 74
240  
241 my $plotter = sub {
242 74 ▶ my $writer = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
243 74 my ($params, $dataset_objects) = _collect_dataset_params($dataset);
244 74 $writer->("$plot_command " . join(",", @$params) . "\n");
245 74 _write_inline_data($writer, $dataset_objects);
246 74 };
247 74 my @commands = ($plotter);
248 74 return $self->run_with(
249 do => \@commands,
250 _pair_slice(\%args, qw(writer async output no_stderr))
251 );
252 }
253  
254 sub _pair_slice {
255 103 ▶ my ($hash_ref, @keys) = @_;
Subroutine _pair_slice: called CC=2 SCAR=6.9
256 103 ▶ return map { exists($hash_ref->{$_}) ? ($_ => $hash_ref->{$_}) : () } @keys;
Branch: 1 branch
BranchTrueFalseTotal
exists $hash_ref->{$_} ? : 64 348 412
257 }
258  
259 sub plot_with {
260 21 ▶ my ($self, %args) = @_;
Subroutine plot_with: called CC=1 SCAR=0.0
Pod documented
261 21 return $self->_draw_with(%args, command => "plot");
262 }
263  
264 sub splot_with {
265 6 ▶ my ($self, %args) = @_;
Subroutine splot_with: called CC=1 SCAR=0.0
Pod documented
266 6 return $self->_draw_with(%args, command => "splot");
267 }
268  
269 sub plot {
270 44 ▶ my ($self, @dataset) = @_;
Subroutine plot: called CC=1 SCAR=0.0
Pod documented
271 44 return $self->_draw_with(command => "plot", dataset => \@dataset);
272 }
273  
274 sub splot {
275 3 ▶ my ($self, @dataset) = @_;
Subroutine splot: called CC=1 SCAR=0.0
Pod documented
276 3 return $self->_draw_with(command => "splot", dataset => \@dataset);
277 }
278  
279 sub multiplot_with {
280 29 ▶ my ($self, %args) = @_;
Subroutine multiplot_with: called CC=5 SCAR=16.1
Pod documented
281 29 my $do = $args{do};
282 29 ▶ croak "do parameter is mandatory" if not defined $do;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $do 0 29 29
283 29 ▶ croak "do parameter must be a code-ref" if ref($do) ne "CODE";
Branch: 1 branch
BranchTrueFalseTotal
if ref $do ne "CODE" 0 29 29
284 my $wrapped_do = sub {
285 29 ▶ my $writer = shift;
Subroutine __ANON__: called CC=3 SCAR=11.0
286 29 my ($wrapped_writer, $data_written_ref, $ended_with_newline_ref) =
287 _wrap_writer_to_detect_empty_data($writer);
288 29 $do->($wrapped_writer);
289 28 ▶ if($$data_written_ref && !$$ended_with_newline_ref) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$data_written_ref and not $$ended_with_newline_ref) 1 27 28
Condition100%3/3
$$data_written_ref and not $$ended_with_newline_ref
!ll&&!rl&&r
2251
MC/DC100%2/2
$$data_written_ref and not $$ended_with_newline_ref
$$data_written_ref not $$ended_with_newline_ref
Truth table100%3/3
A and not(B)
A= $$data_written_refB= not $$ended_with_newline_ref
ABresult
0X0
100
111
290 1 $writer->("\n");
291 }
292 29 };
293 my $multiplot_command =
294 29 ▶ (defined($args{option}) && $args{option} ne "")
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'option'} && $args{'option'} ne '' ? : 8 21 29
Condition100%3/3
defined $args{"option"} and $args{"option"} ne ""
!ll&&!rl&&r
1928
MC/DC100%2/2
defined $args{"option"} and $args{"option"} ne ""
defined $args{"option"} $args{"option"} ne ""
Truth table100%3/3
A and B
A= defined $args{"option"}B= $args{"option"} ne ""
ABresult
0X0
100
111
295 ? "set multiplot $args{option}" : "set multiplot";
296 29 my @commands = ($multiplot_command, $wrapped_do, "unset multiplot");
297 29 return $self->run_with(
298 do => \@commands,
299 _pair_slice(\%args, qw(writer async output no_stderr))
300 );
301 }
302  
303 sub multiplot {
304 3 ▶ my ($self, $option, $code) = @_;
Subroutine multiplot: called CC=4 SCAR=14.0
Pod documented
305 3 ▶ if(@_ == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2) 2 1 3
306 2 $code = $option;
307 2 $option = "";
308 }
309 3 ▶ croak "code parameter is mandatory" if not defined $code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $code 0 3 3
310 3 ▶ croak "code parameter must be a code-ref" if ref($code) ne "CODE";
Branch: 1 branch
BranchTrueFalseTotal
if ref $code ne "CODE" 0 3 3
311 3 return $self->multiplot_with(do => $code, option => $option);
312 }
313  
314 37 our $_context_writer = undef;
315  
316 sub run_with {
317 156 ▶ my ($self, %args) = @_;
Subroutine run_with: called CC=5 SCAR=16.1
Pod documented
318 156 my $commands = $args{do};
319 156 ▶ if(!defined($commands)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $commands) { } 2 154 156
elsif (ref $commands ne 'ARRAY') { } 28 126 154
320 2 $commands = [];
321 }elsif(ref($commands) ne "ARRAY") {
322 28 $commands = [$commands];
323 }
324 156 _wrap_commands_with_output($commands, $self->_plotting_option(\%args, "output"));
325 my $do = sub {
326 156 ▶ my $writer = shift;
Subroutine __ANON__: called CC=6 SCAR=17.9
327 156 ▶ (!defined($_context_writer) || refaddr($_context_writer) != refaddr($writer))
Branch: 1 branch
BranchTrueFalseTotal
!defined($Gnuplot::Builder::Script::_context_writer) || builtin::refaddr($Gnuplot::Builder::Script::_context_writer) != builtin::refaddr($writer) and local $Gnuplot::Builder::Script::_context_writer = $writer 95 61 156
Condition100%3/3
not defined $Gnuplot::Builder::Script::_context_writer or builtin::refaddr($Gnuplot::Builder::Script::_context_writer) != builtin::refaddr($writer)
l!l&&r!l&&!r
821361
MC/DC100%2/2
not defined $Gnuplot::Builder::Script::_context_writer or builtin::refaddr($Gnuplot::Builder::Script::_context_writer) != builtin::refaddr($writer)
not defined $Gnuplot::Builder::Script::_context_writer builtin::refaddr($Gnuplot::Builder::Script::_context_writer) != builtin::refaddr($writer)
Truth table100%3/3
not(A) or B
A= not defined $Gnuplot::Builder::Script::_context_writerB= builtin::refaddr($Gnuplot::Builder::Script::_context_writer) != builtin::refaddr($writer)
ABresult
1X1
011
000
328 and local $_context_writer = $writer;
329
330 156 $writer->($self->to_string);
331 156 foreach my $command (@$commands) {
332 259 ▶ if(ref($command) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $command eq 'CODE') { } 152 107 259
333 152 $command->($writer);
334 }else {
335 107 $command = "$command";
336 107 $writer->($command);
337 107 ▶ $writer->("\n") if $command !~ /\n$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $command =~ /\n$/ 104 3 107
338 }
339 }
340 156 };
341  
342 156 my $result = "";
343 156 my $got_writer = $self->_plotting_option(\%args, "writer");
344 156 ▶ if(defined($got_writer)) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $got_writer) { } 95 61 156
elsif (defined $Gnuplot::Builder::Script::_context_writer) { } 61 0 61
345 95 $do->($got_writer);
346 }elsif(defined($_context_writer)) {
347 61 $do->($_context_writer);
348 }else {
349 0 $result = Gnuplot::Builder::Process->with_new_process(
350 async => $self->_plotting_option(\%args, "async"),
351 do => $do,
352 no_stderr => $self->_plotting_option(\%args, "no_stderr")
353 );
354 }
355 152 return $result;
356 }
357  
358 sub _plotting_option {
359 312 ▶ my ($self, $given_args_ref, $key) = @_;
Subroutine _plotting_option: called CC=2 SCAR=6.9
360 return (exists $given_args_ref->{$key})
361 312 ▶ ? $given_args_ref->{$key}
Branch: 1 branch
BranchTrueFalseTotal
exists $given_args_ref->{$key} ? : 104 208 312
362 : $self->get_plot($key);
363 }
364  
365 sub run {
366 13 ▶ my ($self, @commands) = @_;
Subroutine run: called CC=1 SCAR=0.0
Pod documented
367 13 return $self->run_with(do => \@commands);
368 }
369  
370 37 my %KNOWN_PLOTTING_OPTIONS = map { ($_ => 1) } qw(output no_stderr writer async);
371  
372 sub _check_plotting_option {
373 261 ▶ my ($arg_name) = @_;
Subroutine _check_plotting_option: called CC=2 SCAR=6.9
374 261 ▶ croak "Unknown plotting option: $arg_name" if !$KNOWN_PLOTTING_OPTIONS{$arg_name};
Branch: 1 branch
BranchTrueFalseTotal
if not $KNOWN_PLOTTING_OPTIONS{$arg_name} 3 258 261
375 }
376  
377 sub set_plot {
378 13 ▶ my ($self, %opts) = @_;
Subroutine set_plot: called CC=2 SCAR=6.9
Pod documented
379 13 foreach my $key (keys %opts) {
380 16 _check_plotting_option($key);
381 $self->{pdata}->set_attribute(
382 key => $key,
383 15 value => $opts{$key}
384 );
385 }
386 12 return $self;
387 }
388  
389 sub get_plot {
390 237 ▶ my ($self, $arg_name) = @_;
Subroutine get_plot: called CC=2 SCAR=7.0
Pod documented
391 237 _check_plotting_option($arg_name);
392 236 ▶ croak "arg_name cannot be undef" if not defined $arg_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg_name 0 236 236
393 236 return $self->{pdata}->get_resolved_attribute($arg_name);
394 }
395  
396 sub delete_plot {
397 6 ▶ my ($self, @arg_names) = @_;
Subroutine delete_plot: called CC=2 SCAR=6.9
Pod documented
398 6 foreach my $arg_name (@arg_names) {
399 8 _check_plotting_option($arg_name);
400 7 $self->{pdata}->delete_attribute($arg_name)
401 }
402 5 return $self;
403 }
404  
405 sub Lens {
406 0 ▶ my ($self, $key) = @_;
Subroutine Lens: not called CC=1 SCAR=6.9
Pod undocumented
407 0 require Gnuplot::Builder::Lens;
408 0 return Gnuplot::Builder::Lens->new(
409 "get_option", "set_option", $key
410 );
411 }
412  
413 37 1;
414  
415 __END__
« blib/lib/Gnuplot/Builder/Process.pm ↑ Summary blib/lib/Gnuplot/Builder/PrototypedData.pm »