Page 1 of 1

Argument "gravity" isn't numeric in subroutine entry...

Posted: 2013-02-20T10:41:15-07:00
by johnfl68

I am cleaning up some old code in a script, and I had use strict/warnings commented out, so I uncommented them, and then received the following error on a few lines:

Argument "gravity" isn't numeric in subroutine entry at ... line ...

Probably part of why they were commented out.

The code lines are simple, basically centering $otherimage on a SlateGray background:

Code: Select all

# this is the line before the error line
$image->Extent(gravity => 'Center', geometry => '978x550', background => 'SlateGray');
# this line that has the error
$image->Composite(image => $otherimage, qw(compose gravity Center));
To be honest, I think I copied part of this from somewhere else. The code does work, but I think it is the "qw" that is throwing off warnings.
I sort of understand that the qw is kindof a shortcut for compose gravity and Center, but is it defining them with null/undefined?
Not really sure what the long form code would be, because gravity should be set to Center, but not making sense of why it was done the way it was, other than it worked at the time.

If this makes sense to anyone, as to how to correct this, it would be appreciated.