On Mon, Sep 24, 2001 at 06:42:55PM -0500, Dave Rolsky wrote: > +sub eval_ok (&$) { > + my ($code, $name) = @_; > + > + eval { $code->() }; > + if ($@) { > + ok( 0, "$name - $@" ); > + } else { > + ok( 1, $name ); > + } > +}
The unfortunate problem is this has adverse effects on any code in the block that uses caller(). I don't want tests to introduce side-effects. Unfortunately, Sub::Uplevel doesn't work on anything before 5.6.0. However, you're not the first person that's wanted this. Maybe we can get rid of this problem with documentation. I tend to use this idiom. eval { ...code... }; is( $@, '' ); -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One The eye opening delightful morning taste of expired cheese bits in sour milk!