Craig,

working with Perl 5.14.2 / PDL 2.4.11 under Windows 7, I installed your PDL::Graphics::Gnuplot-1.1 from October 11th, directly after installing gnuplot.

Here are my learnings, maybe they are of some help for you and others:

1. Windows PATH variable
When installing gnuplot (gp470-20120916-win32-mingw.exe) I activated the option to add the gnuplot directory to the windows PATH variable. This is necessary for your module to find gnuplot under Windows, already during installation via cpan.

2. cpan>notest install PDL::Graphics::Gnuplot
I had to install PDL::Graphics::Gnuplot without running the tests. Changes in your Gnuplot.pm had been necessary to make it run gnuplot (->3.)

3. Gnuplot.pm
I had to add some changes similar to those proposed by Rob for PDL::Graphics::Gnuplot 1.0.
I have no chance to produce a nice diff (at least I don't know how to do), so here are my changes:
a) Line 5789: add "or $MS_io_braindamage" to the condition
b) Lines 5833ff: I set $fromerr = '' after throwing warning. 

Both changes are similar to those from Robs mail, I wouldn't be able to solve problems like this myself ...

Finally the gnuplot commands are shown in my cmd.exe window (help me learning gnuplot:-), and Robs example works.

Thanks for PDL::Graphics::Gnuplot, I'll be happy to work with it on the weekend.

Juergen

Sisyphus schrieb:

----- Original Message ----- From: "Craig DeForest" <[email protected]>
To: <[email protected]>
Sent: Tuesday, September 25, 2012 2:23 PM
Subject: [Perldl] PDL::Graphics::Gnuplot 1.0 available in CPAN

PDL::Graphics::Gnuplot has been tested on MacOS and several flavors of
Linux.  It allegedly works with Microsoft Windows (via IPC::Run) but has
not been tested there.

Hi Craig,
Attached is a patch (gnuplot.win32.diff) that enables PDL-G-G-1.0 to work on MS Windows.
Without this patch, windows will invariably and inevitably enter the code block that prints out the warning:

 print STDERR <<"EOM"
WARNING: Hmmm,  gnuplot didn't respond for 8 seconds.  I was expecting to read
  a version number.  Ah, well, I'm returning the object anyway -- but don't
  be surprised if it doesn't work.
EOM

It will then invariably and inevitably enter the code block that prints out the error:

 barf <<"EOM";
Hmmm, my $suffix Gnuplot process didn't respond for $delay seconds.
This could be a bug in PDL::Graphics::Gnuplot or gnuplot itself -- although for some terminals (like x11) it could be because of a
slow network.  If you don't think it is a network problem, please
report it as a PDL::Graphics::Gnuplot bug.  You might be able to
ignore this message, or you might have to restart() the object.
EOM

Obviously, at that point it dies. This all happens because can_read() immediately returns false on Windows whenever it is called on pipes or filehandles.

This patched version also sets $fromerr to the empty string (again to avoid having the script die).
And it it prints the contents of $fromerr to STDERR - so that we can at least see what $fromerr contained.

For my test program I'm using the attached synopsis1.pl. The output that it sends to the console (which is simply the contents of $fromerr) is provided in the attached console.txt.
The gnuplot graph that synopsis1.pl produces looks fine.

This is just a starting point ... does anyone here have any suggestions regarding improvements to this rather lame patch that I've come up with ?
(If not, I'll just submit the patch in its existing form to rt.cpan in a day or two.)

Some things that bother me:

1) Note that, in console.txt, every print of $fromerr seems to be missing the final doublequote character.
Also, all but the first print of $fromerr begin with a doublequote char. (Is that the doublequote that was missing from the end of the previous print ?)

2) I need to employ an <STDIN>; at the end of the script in order to keep the gnuplot window open. Is that normal ?

3) I'm not really very comfortable with having to, in essence, ignore the contents of $fromerr and re-set it to the empty string. There must be something better.

4) http://www.perlmonks.org/index.pl?node_id=942603 mentions some Win32 options to replace IO::Select::can_read(). The alternatives look non-trivial to me, but maybe I just need to look a bit closer.

For anyone interested, I've also attached demo2.pl which contains 11 demos (0 .. 10) all of which seem to work pretty well - except for #9, which hangs.

I'm using gnuplot-4.6.0 binaries from
http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/

Cheers,
Rob
$fromerr:
####
0    last modified 2012-03-04
    Build System: MS-Windows 32 bit


    Copyright (C) 1986-1993, 1998, 2004, 2007-2012

    Thomas Williams, Colin Kelley and many others



    gnuplot home:     http://www.gnuplot.info

    faq, bugs, etc:   type "help FAQ"

    immediate help:   type "help"  (plot window: hit 'h')



gnuplot>
gnuplot>
gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 1 xxxxxxx
####


$fromerr:
####
"

xxxxxxx Synchronizing gnuplot i/o 1 xxxxxxx

gnuplot> set palette
gnuplot> plot   '-' binary array=(101) format="%double"   using 1 notitle with lines
gnuplot>
gnuplot>
gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 2 xxxxxxx
####


$fromerr:
####
"

xxxxxxx Synchronizing gnuplot i/o 2 xxxxxxx

gnuplot> set size noratio

gnuplot> set view noequal

gnuplot> set view 60,30,1.0,1.0

gnuplot>
gnuplot>
gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 3 xxxxxxx
####


$fromerr:
####
"

xxxxxxx Synchronizing gnuplot i/o 3 xxxxxxx

gnuplot> set palette
gnuplot> set title "Parabola with error bars"
gnuplot> plot   '-' binary array=(101) format="%double%double%double"   using 1:2:3 title "Parabola" with xyerrorbars
gnuplot>
gnuplot>
gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 4 xxxxxxx
####


$fromerr:
####
"

xxxxxxx Synchronizing gnuplot i/o 4 xxxxxxx

gnuplot> set size noratio

gnuplot> set view noequal

gnuplot> set view 60,30,1.0,1.0

gnuplot>
gnuplot>
gnuplot> print "xxxxxxx Synchronizing gnuplot i/o 5 xxxxxxx
####



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to