Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Newbie using modules

by moritz (Cardinal)
on Oct 05, 2008 at 19:42 UTC ( [id://715452]=note: print w/replies, xml ) Need Help??


in reply to Newbie using modules

but when I try to run in my computer the little example of the website:

... then what exactly happens? That's the most interesting part, and the thing you left out.

(Please also read What shortcuts can I use for linking to other information?).

Update: I looked at the strace output, and it seems that the image is written to a temporary file first, and only later copied or moved to its destination path. So you should check if the permissions of your tmp directory are ok, and if you have space left on that device.

Replies are listed 'Best First'.
Re^2: Newbie using modules
by diffredential (Beadle) on Oct 05, 2008 at 19:45 UTC
    Sorry your right!! Exacty nothing happens:
    diffredential@fredlab:~/Desktop$ perl myscript.pl diffredential@fredlab:~/Desktop$
    !!

      It seems that the synopsis of the module is incomplete. From reading the documentation further down, there is a ->output($filename) method which writes the chart as an image file to disk. So maybe you have to add another line after the ->plot2d:

      ... $chart->output('mychart.png');
        I tried version 0.05, and the new(output => $out_file) works just fine, and produces the desired output file.
      ... and ls doesn't show a expression.png file? (The desktop view might not be updated immediately, so use ls to check).

      I tried your script (with a different path, of course), and it worked, and with a wrong output path (ie non-existing path) an error message is shown.

      If you are sure that the file is not created, you might try to run your script with strace to find out if a system call failed:

      strace -f perl myscript.pl

      (Update: If you don't know how to read the output from strace, post the last 30 to 50 lines here (in <readmore><code>...</code></readmore> tags), maybe somebody can enlighten you).

      Please check the following:
      1. Type gnuplot --version to check whether gnuplot can be executed.
      2. Check whether the directory /tmp is already full.
      3. Check whether you have write permission of /tmp.

      If they are all fine, then you should be able to use at least the basic features of Chart::Gnuplot. Please re-try your original script with expression.ps as output instead (ps format is more basic than png for the module).

      You don't need the method ->output($filename) although there is no harm to do so. The output method is useful only in cases where you don't know the output filename yet when you create the chart object.

      If you got expression.ps, then it may be the problem of ImageMagick. Please check whether it is installed.

      If you don't want to install ImageMagick and if you want to generate png file. You may try:

      my $chart = Chart::Gnuplot->new( output => "/home/diffredential/Desktop/expression.png", terminal => "png" );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 00:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found