in reply to Re: Re: Re: Idomatic Handling of Subroutine Error
in thread Idomatic Handling of Subroutine Error
# MAIN unless ($result = my_sub($val1, $val2)) { my $err_str = $@; # handle error based on $err_str } # do wonderful things with $result sub my_sub { my ($param1, $param2) = @_; # do stuff if ($bad_data) { eval {die "bad data"}; # ??? return undef; } # do more stuff if ($useless_param2) { eval {die "useless param 2"}; # ??? return undef; } # finish doing stuff return $useful_result; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(5): Idomatic Handling of Subroutine Error
by dragonchild (Archbishop) on Sep 19, 2001 at 00:24 UTC | |
by dvergin (Monsignor) on Sep 19, 2001 at 01:24 UTC |