On Sun, 10 Nov 2002, Michael G Schwern wrote:

> At YAPC::Europe there was some discussion about Test::Builder->level,
> $Test::Builder::Level and the fact that they don't really work well as
> implemented.  I know we reached some sort of consensus about how to do it
> better, but I've forgotten it.

I remember telling you that I do this:

sub test_foo
{
  _bar(shift)
}

sub _bar
{
  # for the rest of this function, call back another frame
  local $Test::Builder::level = $Test::Builder::level + 1;

  ...
}

Does that help?

Surely the best thing to do would be to be able to call something in your
base level function (test_foo in the above example) that declares that
level one.  Then whenever a T::B function is called it automatically looks
back though caller() till it find a level one function and reports from
failure from the caller before that.  The only draw back I can see is it
would mean that test_foo couldn't itself be recursive (though it could
call another function that made it so)

Mark.

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              [EMAIL PROTECTED]
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}



Reply via email to