On Sun, Jul 29, 2001 at 12:38:29PM +0300, Ilmari Karonen wrote:
> On Sat, 28 Jul 2001, Michael G Schwern wrote:
> >
> > Unfortunately, I discovered a problem. Consider...
> >
> > {
> > local $TODO = 'Fix off by one';
> > package Foo;
> > ok( ... );
> > }
> >
> > Since ok() wil have to check ${caller.'::TODO'} you can't switch
> > packages inside the TODO block. This might seem an odd thing to do,
>
> Wait a minute. That shouldn't work at all. It should complain about
> "Undefined subroutine &Foo::ok called at ...", since ok() has not been
> exported to package Foo.
Ahh, you're right. I always make that mistake. It should be ::ok().
> 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.
I think I'll do that. Thanks for the help!
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
Your average appeasement engineer is about as clued-up on computers as
the average computer "hacker" is about B.O.
-- BOFH