sub try (&@) { my($code, $error_handler) = @_; eval { $code->(); }; $error_handler->() if $@; } sub catch (&) { return @_; }