in reply to Local library for module test script

relative paths are relative, and unless you use chdir, they're often wrong

Also, @INC is @INC

Also, lib is a core module

So don't rely on cwd() being "t" or "..\t" because thats weak sauce, one way

BEGIN { use File::Spec; use File::Basename(); our $thisf = File::Spec->rel2abs( $0 ); our $thisd = File::Basename::dirname($thisf); }
then you can  require "$thisd/lib.pm" or chdir $thisd; ...

Replies are listed 'Best First'.
Re^2: Local library for module test script ( @INC cwd pwd chdir )
by mikosullivan (Novice) on Dec 10, 2014 at 04:06 UTC
    That worked very nicely. Thanks!