On Tue, Dec 07, 2004 at 09:32:37AM -0800, Ovid wrote: > Is there is anything in the Test::* hierarchy that allows callbacks to > be triggered on test failures? It would be nice to pass a sub that > automatically dies on warnings, prints stack traces, cleans up temp > files (or preserves them) or any of a number of things that I'd like to > be able to handle. > > Someone's surely done this before, I just can't seem to find anything > that's already implemented.
For individual failures, put a wrapper around Test::Builder->ok(). Use Hook::LexWrap, Sub::Uplevel or Aspects to preserve the call stack. For test-wide failure, use an END block. Check $tb->summary to see if anything failed. Yes, this is nasty and should be easier to do. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern/ I know you get this a lot, but you're breathtaking, like a vision of simplicity