in reply to Perl Module Object - Return fail/success with a fault string
I think this is what you are looking for:
use Scalar::Util qw[ dualvar ];; sub alwaysFails { return dualvar -123, 'Some text to explain the error'; } $rv = alwaysFails();; print "Sub failed with error: $rv" if $rv != 0;; Sub failed with error: Some text to explain the error
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Module Object - Return fail/success with a fault string
by jhyland87 (Sexton) on Jan 03, 2012 at 19:39 UTC | |
by BrowserUk (Patriarch) on Jan 03, 2012 at 19:56 UTC |