I often code things as:
Now you have a choice. If you check the return value (or assign it to undef), then it won't die. If you're lazy and there's an error, then it dies.sub foo { my $error = ...; return $error if (defined wantarray || ! $error); croak "foo failed: $error"; }
In reply to Re^2: wishlist: die-on-failure for built-ins
by dpuu
in thread wishlist: die-on-failure for built-ins
by tlm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |