Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: Chart::Gnuplot and Windows XP

by BrowserUk (Pope)
on Nov 05, 2008 at 15:44 UTC ( #721688=note: print w/ replies, xml ) Need Help??


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

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.


Comment on Re^5: Chart::Gnuplot and Windows XP
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-08-23 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (175 votes), past polls