sub lives_and_tests_ok (&&;$) { my ($case, $test, $name) = @_; local $@; my $result = eval { $case->() }; $@ ? fail($name) : $test->($result, $name); } #### lives_and_tests_ok ( sub { $o->answer }, sub { is shift, 42, shift }, "answer is 42" ); #### sub lives_and_tests_ok (&&;$) { my ($case, $test, $name) = @_; local $@; local ($b, $a) = ($name, eval { $case->() }); $@ ? fail($name) : $test->($result, $name); } #### lives_and_tests_ok ( sub { $o->answer }, sub { is $a, 42, $b }, "answer is 42" );