in reply to Re^2: Perl Module Object - Return fail/success with a fault string
in thread Perl Module Object - Return fail/success with a fault string

The problem is that ! does not provide a numeric context.

use Scalar::Util qw[ dualvar ];; sub alwaysFails { return dualvar 0, 'Some text to explain the error'; +};; $rv = alwaysFails();; print "Sub failed with error: $rv" if !$rv;;

If you want 0 to stand for failed, you'd need to use a test that does provide a numeric context. Eg.

print "Sub failed with error: $rv" if ! 0+$rv;; Sub failed with error: Some text to explain the error print "Sub failed with error: $rv" if ~$rv;; Sub failed with error: Some text to explain the error print "Sub failed with error: $rv" if $rv == 0;; Sub failed with error: Some text to explain the error

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?