On Fri, Dec 14, 2001 at 02:48:07PM -0800, Brent Dax wrote:
> I don't know what directory this should go into,
lib/lib.t I guess.
> so I'm not providing a
> patch, just pasting the body of lib.t in here. Good enough?
>
> #!./perl
>
> use Test::More tests => 3;
> use lib 'stuff';
>
> #create a directory and a module
> mkdir('stuff', 0666);
> open(MOD, '>stuff/Yup.pm');
> print MOD 'package Yup; 1;';
> close MOD;
>
>
> #did the directory show up?
> ok(scalar(grep {/stuff/} @INC), 'added to @INC');
I believe lib.pm is guaranteed to stick the new lib on the front. So
it should appear on @INC[0].
> #does it change require's behavior?
> ok(
> eval { require Yup; 1; },
> 'affects require'
> );
Check that $INC{'Yup'} contains the right file.
> #how about use's?
> is(
> `perl "-Mlib=stuff -MYup" -e "print 'ok'"`,
> 'ok',
> 'affects use'
> );
A simple way to trick 'use' is to clear the entry from %INC and then
eval "use Yup".
> #cleanup
> unlink 'stuff/Yup.pm';
> unlink 'stuff';
rmdir 'stuff'?
Other things need checked.
no lib
the magic behavior when there's $dir/$archname/auto.
@lib::ORIG_INC
That trailing duplicate entries are removed (ie. so @INC doesn't
grow under mod_perl)
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
humble abode cries
there is not enough paste here
restock erotica please
-- imploded