Skip Menu |

This queue is for tickets about the PDL-Graphics-Gnuplot CPAN distribution.

Report information
The Basics
Id: 80005
Status: resolved
Priority: 0/
Queue: PDL-Graphics-Gnuplot

People
Owner: Nobody in particular
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.0
Fixed in: (no value)



Subject: IO::Select::can_read() causing failure on MS Windows
Hi, IO::Select::can_read() always returns false on MS Windows (when called on a pipe), and this leads to failures on MS Windows. The attached patch to Gnuplot.pm enables PDL::Graphics::Gnuplot to work reasonably well on MS Windows ... but is surely in need of some improvement. Cheers, Rob
Subject: PDL-Graphics-Gnuplot-diff.txt
--- Gnuplot.pm_orig 2012-10-02 12:25:47 +1000 +++ lib/PDL/Graphics/Gnuplot.pm 2012-10-02 12:28:30 +1000 @@ -5462,7 +5462,7 @@ if(!$this->{dumping}) { print $in "show version\n"; do { - if($errSelector->can_read(8)) { + if($errSelector->can_read(8) || $^O =~ /MSWin32/i) { my $byte; sysread $err, $byte, 1; $s .= $byte; @@ -5626,7 +5626,7 @@ my $terminal =$this->{options}->{terminal}; my $delay = ($terminal && $termTab->{$terminal}->{delay}) || 8; - if( $this->{"errSelector-$suffix"}->can_read($notimeout ? undef : $delay) ) + if( ($this->{"errSelector-$suffix"}->can_read($notimeout ? undef : $delay)) || $^O =~ /MSWin32/i ) { # read a byte into the tail of $fromerr. I'd like to read "as many bytes # as are available", but I don't know how to this in a very portable way @@ -5657,7 +5657,11 @@ _logEvent($this, "Read string '$fromerr' from gnuplot $suffix process") if $this->{options}{tee}; - $fromerr = $1; + if($^O =~ /MSWin32/i) { + print "\n\$fromerr:\n####\n$fromerr\n####\n\n" if $fromerr; + $fromerr = ''; + } + else {$fromerr = $1} my $warningre = qr{^(?:Warning:\s*(.*?)\s*$)\n?}m;
Thanks for the patch, and the many, many rounds of testing. 1.2 fixes this; by 1.3 we should have the MS Windows kinks worked out...