On Tue, Nov 12, 2002 at 04:21:38PM +0000, Adrian Howard wrote:
> Most of the time when I need to mess with level, the code that does
> the test is sitting in a different package from the one that is
> calling the test. How about having it walk up the call stack until it
> find a package that differs from the one it was called in?

People suggest this so often it needs its own FAQ.

       package Test::Foo::Inside;
       
       my $tb = Test::Builder->new;
       
       sub something {
           $tb->ok(@_);
       }
       
       
       package Test::Foo;
       use Test::Foo::Inside;

       sub wiffle {
           something(@_);
       }


       ...and in your test code...
       use Test::Foo;
       wiffle(....);


Ooops.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
Death was thought to be fatal.
        -- Craig A. Berry in <a05101002b8165afc6b62@[172.16.52.1]>

Reply via email to