Make functions succeed or die in Perl, with lexical scope.