On Wednesday 23 Dec 2009 00:05:40 Ben Morrow wrote:
> Quoth [email protected] (Geoffrey Leach):
> > I'm working on a new release of Getopt::Auto. There's a fair amount of
> > code in the module that applies only to the tests. It would be nice if
> > that code was not in the installed module. Any suggestions?
>
> Given that Perl allows you to put code in any package from any module,
> can you just have a module in your t/ dir that implements the testing
> hooks? Personally I like to put such modules in the t:: namespace, since
> tests are always run from the module build directory, so I might call it
> t::Hooks or some such.
What I normally do is put it under t/lib (say
t/lib/Config/IniFiles/TestFiles.pm) and then do:
<<<
use lib "./t/lib";
use Config::IniFiles::Testfiles;
use Config::IniFiles::OtherHelperModule;
# Etc.
>>>
This is cleaner than calling the module itself "t::", as modules that start
with a lowercase letter should be pragmata.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/
Bzr is slower than Subversion in combination with Sourceforge.
( By: http://dazjorz.com/ )