On Thu, Aug 29, 2002 at 12:29:58AM -0700, Michael G Schwern wrote:

> Also, Nick's example is a little odd.  You usually don't want '.' (ie. t/)
> in your @INC.  It's more like this:
> 
>     BEGIN {
>         if($ENV{PERL_CORE}) {
>           chdir 't';
>           @INC = '../lib';
>       }
>     }
> 
> but in some cases you need to include something more.  For example,
> MakeMaker does this:
> 
>     BEGIN {
>         if($ENV{PERL_CORE}) {
>           chdir 't';
>           @INC = ('../lib', 'lib');
>       }
>       else {
>           unshift @INC, 't/lib';
>       }
>     }
> 
> so it can see specialty helper modules in t/lib/.

> On Thursday, August 29, 2002, at 06:51 AM, Nicholas Clark wrote:
> >You'll often see regression tests in the core start like this:
> >
> >sub BEGIN {
> >    if ($ENV{PERL_CORE}){
> >     chdir('t') if -d 't';
> >     @INC = ('.', '../lib');
> >    } else {
> >     unshift @INC, 't';
> >    }

For information, my example was from the top of t/integer.t in Storable
It looks like the same bit of code was cargo-cult cut & pasted (er, by
me I think) from the other Storable tests (such as freeze.t) where they
have to require 'st-dump.pl'; to get a library of useful test routines.

I'm not sure if Storable was actually the best (cleanest, simplest) thing to
snag the example code from.

Nicholas Clark

Reply via email to