If I have Perl module like
package X;
and an object like
my $x = X->new ();
Inside X.pm, I
Workaround that works but is not nice to see.
Use the select statement.
If you have a function my_func() which you call and then based on the return value you want to do some error processing and then return from the caller you could do:
($result = my_func()) == 0 ? return handle_error($result) : 0;
This is a (ugly) one-liner that substitutes:
$result = my_func();
if ($result == 0) {
handle_error($result);
return;
}
Convenient if you have many function to call and check return value.