On Sun, 29 Jul 2001, Michael G Schwern wrote:
> On Sun, Jul 29, 2001 at 12:38:29PM +0300, Ilmari Karonen wrote:
> > And the "solution" seems obvious too. Export $TODO, so that it gets
> > aliased to every package where ok() is available.
>
> C<local $::TODO> would work, but that's getting yicky.
>
> Hmmm. AHH! What I could do is simply have ok() look for
> $package::i::was::exported::into::TODO (in this case, main) and
> require that C<local $TODO> is the first thing you do in a TODO block.
> This assumes ok() and friends are only exported once, but that's a
> fair assumption.
Isn't it the point of exporting that you can look at $Test::More::TODO
and export that to any package you want it in?
So, if your @EXPORT array contains qw/ok $TODO/, all of the following
approaches will work:
use Test::More;
{
local $TODO = "Take 1";
package Foo;
::ok( 0 );
}
use Test::More;
{
package Foo;
local $::TODO = "Take 2";
::ok( 0 );
}
use Test::More; # presumably some tests are done in main:: too
{
package Foo;
use Test::More; # import into this package too
local $TODO = "Take 3";
ok( 0 );
}
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Life on Earth is _already_ a nanotech system voraciously attempting to
consume everything that it can, and it's been evolving for over four
billion years;" -- Bryan Derksen in rec.arts.sf.science