JohnB has asked for the wisdom of the Perl Monks concerning the following question:

I am using the module CHART.PPM with ActivePerl 5.6 (Build 6.20) with Microsoft Windoze ME and can't get it to work. Am I missing some other modules or is it a dumb typing mistake.

use Chart::Lines; $obj = Chart::Lines->new or "Chart does not work\n"; $obj->set ('title' => 'Graph Test'); @data = ( [ 'foo', 'bar', 'junk' ], [ 30.2, 23.5, 92.1 ] ); # Should create a gif file with graph $obj->gif ("test.gif", \@data);

The last line should create a gif file of the graph but I get this message: Can't locate object method "gif" via package "Chart::Lines" at graph.pl

From what I read in the chart module instructions the next line should create a graph on a web page at the HTML tag IMG SRC="graph_program.pl"</CODE>

$obj->cgi_gif ( \@data );

I get the error message: Can't locate object method "cgi_gif" via package "Chart::Lines" at graph.pl line

Replies are listed 'Best First'.
Re: Problems With Chart Module
by Albannach (Monsignor) on Dec 08, 2000 at 02:58 UTC
    You don't say what version of Lincoln Stein's GD module you're using, but you should know that GIF support has been removed since version 1.19 due to the problem with the ownership of the GIF format. PNG is better anyway!

    Update: You can still get quite a few old versions of GD through here

    --
    I'd like to be able to assign to an luser

(Ovid) Re: Problems With Chart Module
by Ovid (Cardinal) on Dec 08, 2000 at 03:09 UTC
    As Albannach mentioned, gif support has been removed due to the Unisys patent. Also, don't forget the die() call. You have a string in void context :)
    use strict; use Chart::Lines; my $obj = Chart::Lines->new or die "Chart does not work\n"; $obj->set ( title => 'Graph Test'); my @data = ( [ 'foo', 'bar', 'junk' ], [ 30.2, 23.5, 92.1 ] ); # Should create a png file with graph $obj->png ("test.gif", \@data);
    However, don't forget your audience! PNG support is not available in older browsers. Even newer ones tend not to support all of the features of PNG.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

      Methinks you mean $obj->png("test.png", \@data);
Re: Problems With Chart Module
by tune (Curate) on Dec 08, 2000 at 04:51 UTC
    Create a PNG and convert it to GIF. Linux boxes usually have the ImageMagick package and 'mogrify' in it, and the 'convert' utility. I used to create charts with gnuplot, which puts out ppm, and must be converted to gif with ppmtogif.

    -- tune

      It works!

      I reloaded the GD module and fixed the error with the die command.

      Thank everyone for your help.