Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Re^5: Chart::Gnuplot and Windows XP by BrowserUk
in thread Chart::Gnuplot and Windows XP by dHarry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found