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

constant problem with GD's newFromGif

by maard (Pilgrim)
on Sep 01, 2005 at 10:52 UTC ( #488346=perlquestion: print w/ replies, xml ) Need Help??
maard has asked for the wisdom of the Perl Monks concerning the following question:

This code:
open F, TMP_GIF_FNAME; my $im = GD::Image->newFromGif( F ); close F;
dies with this message: Can't use an undefined value as a symbol reference at /usr/local/lib/perl5/site_perl/5.8.6/i386-freebsd/GD/Image.pm line 193.

In GD/Image.pm:

sub newFromGif { croak("Usage: newFromGif(class,filehandle,[truecolor])") unless @_ +>=2; my($class) = shift; my($f) = shift; my $fh = $class->_make_filehandle($f); binmode($fh); # <-- line 193 $class->_newFromGif($fh,@_); }

Versions:
GD: 2.27
gd: 2.0.33

What am I doing wrong?

Comment on constant problem with GD's newFromGif
Select or Download Code
Re: constant problem with GD's newFromGif
by Roger (Parson) on Sep 01, 2005 at 11:01 UTC
    Try my $im = GD::Image->newFromGif( \*F );

    Hang on, did you check whether your open succeeded or not? Do this instead:
    open F, TMP_GIF_FNAME or die "Can not open image: $!";
      open F, TMP_GIF_FNAME or die "Can not open image: $!";
      You're right, that was the reason (I overlooked it, because the code became too heavy instead of several lines, written several days ago, because I coudn't create image from GIF data, only from file).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://488346]
Approved by Roger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-07-13 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls