Re: Discussion/request on Test::More , have it add t/lib to @INC if -d
[email protected] (David Cantrell) Fri, 31 Jan 2014 13:50:16 +0000
| Newsgroups | perl.qa |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jan 30, 2014 at 10:36:19PM -0500, D Perrett wrote:
> > use t::lib::MyPackage;
> Nice tip!
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.
--
David Cantrell | Godless Liberal Elitist
Seven o'clock in the morning is something that
happens to those less fortunate than me