On Thu, Jul 08, 2004 at 08:40:54PM -0400, Michael G Schwern wrote:
> On Thu, Jul 08, 2004 at 11:53:52PM +0100, Fergal Daly wrote:
> > The main point was that the OO way works right now,
>
> So does event hooks. Hooks are things you can hang stuff off of, but
> they're also used to snare things that might not want to be snared.
>
> In other words...
>
> use Test::Builder;
> use Hook::LexWrap;
>
> wrap 'Test::Builder::ok',
> post => sub {
> my $tb = shift;
> my $ok = $_[-1];
>
> enter_the_debugger if !$ok;
> };
>
> Or something like that.
Is there a LexWrap equivalent of
use Test::Builder::Vapour::Override;
sub diag {
my ($self, $diag) = @_;
$self->SUPER::diag(colour_me($diag));
}
? It seems that LexWrap wrappers can't do this as they can't change the
args.
If you want to make it all possible, via events and hooks then I think it
does require putting callbacks into or around all the relevant methods -
which is what I thought you were proposing in the first mail. Not difficult
but not trivial either.
While you're here, any chance you'd consider converting Test::Builder to be
hash based rather than class based with a way of creating new instances.
Obviously there should be only 1 real Test::Builder object but allowing
other instances would make test-module testing easier and test nesting
(suites of suites etc) possible,
F