in reply to how to return info from functions
I'd say just put this at the top of rollback():
return if ! defined $_[0];
I don't recommend this, but it almost works:
rollback( methodfunction( 'foo' ) or goto NO_ROLLBACK ); NO_ROLLBACK: print "done\n"; sub rollback { my $s = shift; print "rollback('$s') called\n"; } sub methodfunction { return $_[0]; }
Try it with undef instead of 'foo', and you can see it skips the call to rollback. However, it also does this for other false values (0, '0', or the empty string).
|
|---|