in reply to How to return an appropriate error from module?
What I often do in these cases is for the method/sub to return a hash.
( success => 0, data => q{whatever}, message => q{something horrible happened}, )
my %result = validate($arg1, $arg2); if ($result{success}){ # woot! we can continue # do something with $result{data} } else{ # try again send_screen_back($result{message}); }
|
|---|