in reply to Error Handling Misconception
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Error Handling Misconception
by chromatic (Archbishop) on Sep 03, 2003 at 23:09 UTC | |
Re: Re: Error Handling Misconception
by perrin (Chancellor) on Sep 04, 2003 at 01:19 UTC |
In Section
Seekers of Perl Wisdom