On Thu, Jul 08, 2004 at 01:59:35PM -0400, Michael G Schwern wrote:
> Likely you'd control if you wanted this behavior with 
> HARNESS_PERL_SWITCHES=-MTest::AutoDebug
> 
> This can be implemented, currently, by adding a post hook onto 
> Test::Builder->ok() with Hook::LexWrap or Sub::Uplevel.  I'm considering
> future versions of Test::Builder to offer some sort of event subscriber
> system so people can more easily do this sort of thing.

The debugger thing sounds very nice but rather than event hooks, why not use
OO.

package Test::Debug;

use Test::Builder;

@ISA= 'Test::Builder';

*Test::Builder::new = sub {Test::Debug};

sub ok
{
        my $self = shift;
        my $ok = shift;

        if ($ok)
        {
                local $Test::Builder::Level = $Test::Builder::Level + 1;
                $self->SUPER::ok($ok);
        }
        else
        {
                debugger_me();
        }
}

most of the above could be in Test::Builder::Override,

F


Reply via email to