I'm probably missing something important here, but ... why would anyone want to write
my $res = eval { something(...); }; if ($@) { die $@; } else { do_something_more(...) } return $res;
I mean ... if the something(...) does throw an exception, the code catches the exception only to rethrow it unchanged (I checked that with die "foo", die "foo\n"; and die $object.), if it doesn't something more is done and the result of that something(...) is returned.
So as far as I can tell it's equivalent to
my $res = do { something(...); }; do_something_more(...) return $res;
Or, if there really is just one expression within the eval{}:
my $res = something(...); do_something_more(...) return $res;
Or not? Am I missing something or is XML::SAX::Base (1.04) cargoculting?
In reply to Why <c>eval {...};if ($@) { die $@ } else { ...</c> ??? by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |