Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Isn't numeric In subroutine?!?

Status
Not open for further replies.

zackiv31

Programmer
May 25, 2006
148
US
Here's my code, I'm trying to read in an image, and I get a weird error:

Code:
/usr/bin/perl

use strict;
use warnings;

#use Test::More plan => 1;
use Test::Image;

print "Hello\n";

my $i = Test::Image->new(Image::Imlib2->new("circle.jpg"));
ok($i, "image ok");


I get this error output:
Code:
Hello
Argument "circle.jpg" isn't numeric in subroutine entry at ./recognize.pl line 11.
***** Imlib2 Developer Warning ***** :
        This program is calling the Imlib call:

        imlib_image_set_has_alpha();

        With the parameter:

        image

        being NULL. Please fix your program.
No image passed at ./recognize.pl line 11
# Looks like your test died before it could output anything.

I got the code from here:

and yes, "circle.jpg" does exist in the current directory.
 
mabe you need to add some more code to the script.

$i->size(400,300); # (see also $i->width, $i->height)

just a guess, I have never used nor even heard of this module before. It seems the point is to test something about the image, your code is not doing that, so maybe the imlib_image_set_has_alpha() function is expecting some numeric data. This is a very new module and the author apparently wrote it while on an airplane (see "More Bugs" section of module) so maybe he forgot to test it.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I think it might have to do with that planning stuff, the use I commented out... I copied their code directly and get this error now:

Code:
plan() doesn't understand plan 1 at ./test.pl line 3.
BEGIN failed--compilation aborted at ./test.pl line 3.
# Looks like your test died before it could output anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top