Here's a rather funky example taken from the perl docs (
man perlsub) that may provide a worthwhile solution -
sub try (&@) {
my($try,$catch) = @_;
eval { &$try };
if ($@) {
local $_ = $@;
&$catch;
}
}
sub catch (&) { $_[0] }
try {
die "phooey";
} catch {
/phooey/ and print "unphooey\n";
};
This is simliar to a lot of the above posts, in that it
eval()s and then handles any errors. Although it's not *exactly* the sub wrapper you were looking for, I think it's a very cool alternative (but then again I'm impressed by all things functional ;o)
HTH
broquaint