I agree, t::lib::Foo is really the obious solution to my first question.

For the other part, I like that evil magic thing, I'll probably publish a
separate module that requires and imports all pm files it finds under t/lib
or someother assigned dir. It'll still be only one code line in my .t ,
only should I put more pm files there it will do them all.

Thanks.

T.



On Fri, Jan 31, 2014 at 4:36 AM, D Perrett <perret...@googlemail.com> wrote:

> > use t::lib::MyPackage;
>
> Nice tip!
>
> Searching on "use t::lib" led me to PPI which has both lib/PPI.pm and
> t/lib/PPI.pm - I suspect that they're not interchangeable and that
> trying to add t/lib to @INC would break its tests.
>
> Daniel
>
> On 30 January 2014 22:25, Leon Timmermans <faw...@gmail.com> wrote:
> > On Fri, Jan 31, 2014 at 1:59 AM, Torbjørn Lindahl
> > <torbjorn.lind...@gmail.com> wrote:
> >>
> >>
> >> It seems t/lib is a common place to put modules used to support testing,
> >> how about having Test::More push that path to @INC if -d 't/lib' ? It
> would
> >> save me one , possibly two annoying lines of code in every .t file I
> write.
> >> With an import tag, ':automiport' or something, it could perhaps
> require all
> >> .pm files in that dir too/instead?
> >
> >
> > I don't like magical behavior. «use lib 't/lib';» is far more
> > self-documenting, and automatically requiring all .pm files is plain
> evil.
> >
> >>
> >> personally I end up with use lib 't/lib' in 9 of 10 projects.
> >
> >
> > For me it's less than 1 in 10. I wouldn't be surprised if I'm closer to
> the
> > average than you TBH, YMMV.
> >
> > Leon
>



-- 
mvh
Torbjørn Lindahl

Reply via email to