Subject: | uses exit not die or croak |
Date: | Wed, 04 Apr 2007 10:27:00 +0100 |
To: | bug-Image-EXIF [...] rt.cpan.org |
From: | Rich Lott <rl5 [...] shinyblue.net> |
Hi
Because new Image::EXIF('problemfile.jpg') calls exit not die, it is
untrappable.
This is a shame because Image::EXIF does lots of validity tests that
would otherwise have to be repeated before Image::EXIF is called. Or it
would have to be called with a fork() which is v. messy.
use Image::EXIF;
my $file = "broken_jpeg.jpg";
my $exif=new Image::EXIF;
eval { $exif->file_name($file); };
if ($@)
{
print STDERR "problem with $file\n";
# ... this code never gets called.
}
Thanks
Rich.