| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Gnuplot::Builder::TempFile; |
|
2
|
1
|
|
|
1
|
|
22411
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
46
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
44
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use Exporter qw(import); |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
40
|
|
|
5
|
1
|
|
|
1
|
|
1363
|
use File::Temp; |
|
|
1
|
|
|
|
|
29360
|
|
|
|
1
|
|
|
|
|
80
|
|
|
6
|
1
|
|
|
1
|
|
8
|
use File::Spec; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
21
|
|
|
7
|
1
|
|
|
1
|
|
1006
|
use IPC::Open3 qw(open3); |
|
|
1
|
|
|
|
|
2997
|
|
|
|
1
|
|
|
|
|
65
|
|
|
8
|
1
|
|
|
1
|
|
936
|
use Gnuplot::Builder 0.13 (); |
|
|
1
|
|
|
|
|
27691
|
|
|
|
1
|
|
|
|
|
21
|
|
|
9
|
1
|
|
|
1
|
|
10
|
use Gnuplot::Builder::Process; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
15
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
633
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = "0.03"; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(run); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
|
17
|
|
|
|
|
|
|
my $null_handle; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _null_handle { |
|
20
|
0
|
0
|
|
0
|
|
|
return $null_handle if defined $null_handle; |
|
21
|
0
|
|
|
|
|
|
my $devnull = File::Spec->devnull; |
|
22
|
0
|
0
|
|
|
|
|
open $null_handle, ">", $devnull or confess("Cannot open $devnull: $!"); |
|
23
|
0
|
|
|
|
|
|
return $null_handle; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub run { |
|
28
|
0
|
|
|
0
|
1
|
|
my (@gnuplot_command) = @_; |
|
29
|
0
|
|
|
|
|
|
local $| = 1; |
|
30
|
0
|
0
|
|
|
|
|
if(!@gnuplot_command) { |
|
31
|
0
|
|
|
|
|
|
@gnuplot_command = qw(gnuplot --persist); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
0
|
|
|
|
|
|
my $tempfile = File::Temp->new; |
|
34
|
0
|
|
|
|
|
|
$tempfile->unlink_on_destroy(0); |
|
35
|
|
|
|
|
|
|
Gnuplot::Builder::Process::MockTool::receive_from_builder *STDIN, *STDOUT, sub { |
|
36
|
0
|
|
|
0
|
|
|
my ($data) = @_; |
|
37
|
0
|
|
|
|
|
|
$tempfile->print($data); |
|
38
|
0
|
|
|
|
|
|
}; |
|
39
|
0
|
|
|
|
|
|
$tempfile->close; |
|
40
|
0
|
|
|
|
|
|
_execute(@gnuplot_command, $tempfile->filename); |
|
41
|
0
|
|
|
|
|
|
_execute("gnuplot_builder_tempfile_remover", $tempfile->filename); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _execute { |
|
45
|
0
|
|
|
0
|
|
|
my (@command) = @_; |
|
46
|
0
|
|
|
|
|
|
my $pid = open3(my $in, _null_handle(), undef, @command); |
|
47
|
0
|
|
|
|
|
|
close $in; |
|
48
|
0
|
|
|
|
|
|
return $pid; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
|
52
|
|
|
|
|
|
|
__END__ |