Skip to content

Commit b53f3b2

Browse files
committed
PLplot 3-arg open
1 parent a5533fd commit b53f3b2

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/PDL/Graphics/Simple/PLplot.pm

+11-12
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ sub check {
6666
my ($fh2, $gzouta) = tempfile('pgs_gzouta_XXXX');
6767
close $fh2;
6868

69-
open FOO, ">$gzinta" or die "Couldn't write to temp file";
70-
print FOO "1\n"; #Just one line
71-
close FOO;
69+
open my $fh3, ">", $gzinta or die "Couldn't write to temp file";
70+
print $fh3 "1\n"; #Just one line
71+
close $fh3;
7272

7373
if($^O =~ /MSWin32/i) {
7474
eval {require Win32::Process};
@@ -86,6 +86,8 @@ sub check {
8686
0,
8787
32, #NORMAL_PRIORITY_CLASS
8888
".")|| die ErrorReport();
89+
90+
sleep 1; # Don't read $gzouta before it's written
8991
}
9092
else {
9193
my $pid = fork();
@@ -97,9 +99,9 @@ sub check {
9799
if( $pid==0 ) { # assignment
98100

99101
# Daughter: try to create a PLplot window with a bogus device, to stimulate a driver listing
100-
open STDOUT,">$gzouta";
101-
open STDERR,">&STDOUT";
102-
open STDIN, "<$gzinta";
102+
open STDOUT,">", $gzouta;
103+
open STDERR,">&", STDOUT;
104+
open STDIN, "<", $gzinta;
103105
PDL::Graphics::PLplot->new(DEV=>'?');
104106
exit(0);
105107
}
@@ -110,12 +112,10 @@ sub check {
110112
waitpid($pid,0); # Clean up.
111113
}
112114

113-
sleep 1 if $^O =~ /MSWin32/i; # Don't read $gzouta before it's written
114-
115115
# Snarf up the file.
116-
open FOO, "<$gzouta";
117-
my @lines = <FOO>;
118-
close FOO;
116+
open my $fh4, "<", $gzouta;
117+
my @lines = <$fh4>;
118+
close $fh4;
119119

120120
unlink $gzinta;
121121
unlink $gzouta;
@@ -138,7 +138,6 @@ sub check {
138138
}
139139

140140
$filetypes = {};
141-
142141
for my $k (keys %{$guess_filetypes}) {
143142
VAL:for my $v ( @{$guess_filetypes->{$k}} ) {
144143
if ($mod->{devices}->{$v}) {

0 commit comments

Comments
 (0)