On Tue, Mar 08, 2005 at 09:36:24PM +0000, Fergal Daly wrote:
> Cool, so actually T::B::Counter and T::B::Run are not singletons and
> Test::Builder is.

No, other way around.  When a TB instance needs a TB::Counter it just says 
$tb->counter which, normally, returns a singleton but you can alter counter()
so it returns something else.


> I know what it is, I just don't understand what it means for a module to
> have a default level. So:
> 
> 1 - What does it means for Test::D to have a default level of 2? Does it mean
> that all calls on the T::B object have to originate from exactly 2 levels of
> calls into Test::D? 

Yes.  This is why the default is 1.


> If so, what can I do if some are from depth 3 or 1?

You temporarily change the level inside the scope of that function.


> 2 - What happens if Test::C::do_multiple_tests() calls Test::D::some_test()?
> The correct level is now
> Test::C's default level + Test::D's default level - 1

This is why the idiom is currently:

        local $Level = $Level + 2;

or whatever.  You add to the existing level rather than just setting it anew.

Reply via email to