On Sun, 22 Jul 2001 [EMAIL PROTECTED] wrote:
> On Sun, Jul 22, 2001 at 02:19:25AM -0700, Randal L. Schwartz wrote:
> >
> > sub TODO (\&) {
> > local($INSIDE_TODO) = 1;
> > TODO: shift->();
> > }
>
> That was my original plan, problem is it modifies the results of
> caller() (so things like carp() would be altered). Since it's a
> general testing function, I'm trying to keep its effects on the
> surrounding code at near 0.
The question then becomes how close to 0 is close enough. Obviously you
*can't* get to 0, since there has to be some way for the block to alter
the behavior of *your* code. So, would adding an extra level to the
call stack be close enough or not?
And how pretty does the syntax have to be? This will work:
{ local $TODO = "foo() still not defined";
ok( defined $self->foo() );
}
Actually, it's not even ugly at all, really. True, the guts are
showing, but that's quite common in Perl. And it involves no new syntax
that would have to be looked up in the docs.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Humanity doesn't aspire to perfection, it aspires to a lack of fiscal
accountability." -- Brandon Van Every in rec.arts.sf.science