I am new to Perl and trying to learn graphics by the examples given in Shaun 
Wallace's Perl Graphics Programming.  I'm using Perl 5.8 and have installed 
GD and GD::Graph using CPAN.  I've checked to verify both modules are 
installed using a "findmodules" script I found elsewhere, and here is a 
snippet with the versions:

GD -- 1.41
GD::Graph -- 1.35

Next I copied the following example script from the author's supporting page 
at O'Reilly's site:

----------------------------------
#!/usr/bin/perl -w
# Example 2-1. Hello world in GD

use strict;
use GD;

my $image = new GD::Image(401,201);
$image->trueColor();
my $gray = $image->colorAllocate(200, 200, 200);
my $red = $image->colorAllocate(255, 0, 0);
my $black = $image->colorAllocate(0, 0, 0);

# Draw a field of polka dots with random diameters

foreach my $i (0..10) {
    foreach my $j (0..5) {
        my $d = rand(50)+1;
        $image->arc($i*40, $j*40, $d, $d, 0, 360, $red);
        $image->fill($i*40, $j*40, $red);
    }
}

# Draw the text in black

my ($x1, $y1, $x2, $y2,
    $x3, $y3, $x4, $y4) = $image->stringFT($black, 
        "/home/shawn/arial.ttf", 48, 0, 40, 120, "Hello World");

# Outline the text with a black box

$image->rectangle($x1-10, $y1+10, $x3+10, $y3-10, $black);

print $image->png; 
----------------------------------

After that, I chmod a+x, and then tried to execute it. Here is the error 
message that I'm getting:

$ ./example2-1
Can't locate object method "trueColor" via package "GD::Image" at ./example2-1 
line 8.

I haven't found any related information elsewhere about what this particular 
error is telling me.  I get the same response when I try to pipe the output 
to display.

What am I doing incorrectly? 

Thanks,
Clint

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to