To catch die's with eval, the eval block must be terminated with a semi-colon.
So you'd better be off rewriting the while as
for (;;) { my $value = eval { $object->next_val() }; if ($@) { print "Error: $@\n"; next; } last unless $value; # do something useful... }
Hope this helps, -gjb-
Update: Althought chromatic puts it very politely, he's dead right: the semi-colon stuff above was nonsense. Thanks chromatic for making me think twice.In reply to Re: Error Handling Misconception
by gjb
in thread Error Handling Misconception
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |