Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Chart::Gnuplot and Windows XP

by dHarry (Abbot)
on Nov 05, 2008 at 15:09 UTC ( [id://721678]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Chart::Gnuplot and Windows XP
in thread Chart::Gnuplot and Windows XP

You're right BrowserUK.

I have upgraded to version 005 of GnuPlot and it is corrected in that version. However the error message still remains. I suspect it’s the _thaw method. Reading the TODO for the sub the author is well aware of the problem. I changed CLEANUP => 1 into => 0 and the created plot file looks correct to me. The argument created for gnuplot is still flawed, e.g. \tmp\L9LpBMXAW0/plot. I will dig a little deeper.

Update
Fixed typo

Replies are listed 'Best First'.
Re^5: Chart::Gnuplot and Windows XP
by BrowserUk (Patriarch) on Nov 05, 2008 at 15:44 UTC
    The argument created for gnuplot is still flawed, e.g. \tmp\L9LpBMXAW0/plot . I will dig a little deeper.

    There are quite a few places that require modification. This diff isn't meant to be suitable as a patch, just an indicator of where thing need changes and what might be suitable.

    For example, I have both TMP and TEMP environment variables set on my system, but I've long since forgotten whether I set up the former or whether it is set by default. I also have no idea is either is available on typical *nix systems.

    And as I said earlier, to do the job right you'd have to get into moving the duplicate code into separate subroutines and using File::* modules in order to make properly cross-platform. But again, I don't know enough about these requirements to suggest anything beyond how to make it work on Win32.

    Anyway, this might help you get something going. Good luck.

    --- \perl\site\lib\Chart\Gnuplot.pm Wed Nov 05 15:21:26 2008 +++ Gnuplot.pm Wed Nov 05 15:33:43 2008 @@ -15,8 +15,11 @@ # Create temporary file to store Gnuplot instructions if (!defined $hash{_multiplot}) # if not in multiplot mode { - my $dirTmp = tempdir(CLEANUP => 1, DIR => '/tmp'); - $hash{_script} = "$dirTmp/plot"; +# my $dirTmp = tempdir(CLEANUP => 1, DIR => '/tmp'); + my $dirTmp = tempdir(CLEANUP => 1, DIR => $ENV{TMP} || $ENV{T +EMP} ); +# $hash{_script} = "$dirTmp/plot"; + $hash{_script} = $^O eq 'MSWin32' ? "$dirTmp\\plot" : "$dirTm +p/plot"; + } # Default terminal: postscript terminal with color drawing elemen +ts @@ -819,7 +822,8 @@ { my ($self) = @_; - my $pltTmp = "$self->{_script}/plot"; +# my $pltTmp = "$self->{_script}/plot"; + my $pltTmp = $^O eq 'MSWin32' ? "$self->{_script}\\plot" : "$self +->{_script}/plot" open(PLT, ">$pltTmp") || confess("Can't write gnuplot script $plt +Tmp"); print PLT "set terminal $self->{terminal}\n"; print PLT "set output \"$self->{output}\"\n"; @@ -1002,8 +1006,10 @@ my $ydata = $self->{ydata}; # Create temporary file to store Perl data - my $dirTmp = tempdir(CLEANUP => 1, DIR => '/tmp'); - my $fileTmp = "$dirTmp/data"; +# my $dirTmp = tempdir(CLEANUP => 1, DIR => '/tmp'); + my $dirTmp = tempdir(CLEANUP => 1, DIR => $ENV{TMP} || $ENV{T +EMP} ); +# my $fileTmp = "$dirTmp/data"; + my $fileTmp = $^O eq 'MSWin32' ? "$self->{_script}\\data" : " +$dirTmp/data"; open(DATA, ">$fileTmp") || confess("Can't write data to temp +file"); # Process 3D data set @@ -1215,8 +1221,10 @@ { my $pt = $self->{points}; - my $dirTmp = tempdir(CLEANUP => 1, DIR => '/tmp'); - my $fileTmp = "$dirTmp/data"; +# my $dirTmp = tempdir(CLEANUP => 1, DIR => '/tmp'); + my $dirTmp = tempdir(CLEANUP => 1, DIR => $ENV{TMP} || $ENV{T +EMP} ); +# my $fileTmp = "$dirTmp/data"; + my $fileTmp = $^O eq 'MSWin32' ? "$self->{_script}\\data" : " +$dirTmp/data"; open(DATA, ">$fileTmp") || confess("Can't write data to temp +file"); # 2D data points

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://721678]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found