If you declare the pragma, "use strictl" then you should declare all
variables as my:

my($im, $red, $blue);


----- Original Message -----
From: "tom poe" <[EMAIL PROTECTED]>
To: "zentara" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 7:10 PM
Subject: Re: no luck pie charts and perl


> On Thursday 25 October 2001 12:04, zentara wrote:
> > > tried this example, didn't work. In place of the picture I got
nothing,
> > >but something was using the space.
> > >see the code do I miss anything?
> > >thank you
> > >
> > >Pierre
> > >   use GD;
> > >
> > >   # create a new image
> > >    $im = new GD::Image(100,100);
> > >    # allocate some colors
> > >    $red = $im->colorAllocate(255,0,0);
> > >    $blue = $im->colorAllocate(0,0,255);
> > >    # no background
> > >    do I need the background
> > >    # Draw a blue oval
> > >    $im->arc(50,50,95,75,0,360,$blue);
> > >    # And fill it with red
> > >    $im->fill(50,50,$red);
> > >    # make sure we are writing to a binary stream
>    binmode DATA;
> # Convert the image to PNG and print it to createpng.png
> open DATA, ">createpng.png" or die "Cannot open createpng.png for writing:
> $!";
> print DATA $im->png;
> close DATA;
>
> > >    print $im->png;
> >
> > It works for me if I direct the output to a file:
> > testgd.pl > test.png
> > then I can view test.png with my viewer
> > Maybe the code needs to be changed to print
> > to a file instead of STDOUT ??
>
>
> Hi, Zentara:  I fiddled [far more than one would expect], and used the
> recently posted write to file format above, and it works with the top
line,
> "#! /usr/bin/perl -w".  But, if I add "use strict;" at the top of the
script,
> I can't compile:
> tompoe@aether:~/perlStuff > createpng
> Global symbol "$im" requires explicit package name at ./createpng line 5.
> Global symbol "$red" requires explicit package name at ./createpng line 7.
> Global symbol "$im" requires explicit package name at ./createpng line 7.
> Global symbol "$blue" requires explicit package name at ./createpng line
8.
> Global symbol "$im" requires explicit package name at ./createpng line 8.
> Global symbol "$im" requires explicit package name at ./createpng line 11.
> Global symbol "$blue" requires explicit package name at ./createpng line
11.
> Global symbol "$im" requires explicit package name at ./createpng line 13.
> Global symbol "$red" requires explicit package name at ./createpng line
13.
> Global symbol "$im" requires explicit package name at ./createpng line 19.
> Execution of ./createpng aborted due to compilation errors.
>
> So, since we're here, do you understand what the message is?  A required
> explicit package name?  I'm lost.  Thanks, Tom
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



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

Reply via email to