On Fri, Jan 31, 2014 at 2:50 PM, David Cantrell <da...@cantrell.org.uk>wrote:

> That has a few caveats though.
>
> Your %INC will be a bit screwy, which may matter to some code. And it
> will fail to run MyPackage->import(), because t::lib::MyPackage::import
> doesn't exist.
>
>   $ cat t/lib/MyPackage.pm
>   package MyPackage;
>   sub import { print "import() was called\n" }
>   1;
>
>   $ perl -e 'use t::lib::MyPackage;'
>
>   $ perl -e 'use lib "t/lib";use MyPackage;'
>   import() was called
>
> There may be other hidden weirdness that I've forgotten about.
>


  Yeah; just name the package accordingly, and, screwy or not, it'll still
work:

package t::lib::MyPackage;
sub import { print "import() was called\n" }
1;

  :)


Eirik

Reply via email to