On Wed, May 06, 2009 at 12:15:38PM -0400, David Golden wrote:
On Wed, May 6, 2009 at 12:05 PM, David Cantrell <da...@cantrell.org.uk > wrote:
That's true, but this isn't just about testing libs - it's any lib I
might delete from the distribution.
You want Devel::Hide.
I think the original question was about catching a module deleted by
mistake -- otherwise, Devel::Hide rocks.

Exactly.  If I accidentally delete Foo/Bar.pm in my Foo-Bar
distribution, then that recipe would hide any Foo::Bar that's already
installed, but still try to load it from blib/* when I try to build the distro. And then, because it was accidentally deleted, complain loudly.

Ok. Thanks for the mention of Devel::Hide. There is also Test::Without::Module and Module::Mask, which all look pretty similar.

But I still have two problems with using any of these directly:

1) I have to specify exactly which modules to hide. Since I don't know in advance which modules I might delete, I want to hide all the modules that CHI provides (which will be tedious and error-prone to list), or at least hide everything matching /^CHI::/.

2) I have to compute the right exception paths. Doing "use lib qw(blib/ lib blib/arch)" as you suggest would only work if the tests were run from the main directory. e.g. If I'm in the t/ directory and do "perl - I../lib foo.t", as I do sometimes, it ought to work as well.

Would this make sense as its own module, or as an enhancement of one of the above? e.g.

    foo.t:
    use Test::More;
    use Test::UseOnlyMyVersionsOfTheseModules qr(/^CHI/);

but with a shorter name. :)

Jon

Reply via email to