Exceptions cannot be caught - always stops execution

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
hermann2

Exceptions cannot be caught - always stops execution

Post by hermann2 »

Hi,

Ok, so I've spent the past 3 hours banging my head against a brick wall. I hope someone out there can help. I'm using ImageMagick 6.0.7 with the PerlMagick API on Linux ES4.

I'm trying to catch any exceptions encountered during the following operation:

Code: Select all

my $err = $image->Annotate(x=>20, y=>39, fill=>"#330000", font=>"VAGRound", badparameter=>'233', text=>'Hello');
print "Exception: $err \n";
HOWEVER, perl simply stops and gives me the error, 'Exception 410: unrecognized option 'badparameter' at ..., without ever getting to the print statement.

I've tried using eval, to no avail. Also, BTW, prior to calling Annotate(), I construct the image as follows (without problems) in case it matters:

Code: Select all

my $image = Image::Magick->new(magick=>'gif');
$image->BlobToImage($img);
Does anyone have *any* idea what's going on? Is there a special setting I need to set so that ImageMagick/PerlMagick will behave as stated in the documentation?

Thanks in advance!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Exceptions cannot be caught - always stops execution

Post by magick »

We tried your script with ImageMagick 6.3.3 and it worked as expected. You may need to upgrade.
hermann2

Re: Exceptions cannot be caught - always stops execution

Post by hermann2 »

I ran this on a different machine with ImageMagick 6.2.9, and it worked as expected. Thank you for the suggestion!

So, it's clear that there's an issue with 6.0.7 in catching exceptions. This is somewhat significant in that this is the standard release of ImageMagick on RH ES4. Luckily, they've moved to 6.2.8 with the recent release of ES5, but to all you ES4+ImageMagick users still out there, beware...

Thanks again for the assist!
Post Reply