On Fri, Nov 30, 2007 at 09:38:23AM -0800, Bill Moseley wrote:
> On Fri, Nov 30, 2007 at 05:26:19PM +0000, David Cantrell wrote:
> > Changing the topic somewhat, a really good module for pretending that
> > various modules don't exist is Devel::Hide.  The -from:children switch
> > will even hide modules from child processes.
> Thanks for the tip!
> $ perl -MDevel::Hide=Net::CIDR -Iblib/lib t/10-Field-CIDR_List.t
> Devel::Hide hides Net/CIDR.pm
> 1..6
> ok 1 # skip Skip: failed to load module Net::CIDR
> ...
> So I'm using Module::Install with "recommends".  Not sure if that does
> anything, but it would be handy to be able to automatically hide those
> when running make test.

All M::I does for "recommended" modules is prompt the user whether to
install them or not, defaulting to "yes".  You want to test both with
and without those modules, at least for your own pre-release testing.
For the *users'* testing when they install it, it looks like you're
doing the right thing already.

Presumably you've got all the optional modules installed on your dev
system, so you could do something like this in your biuld directory just
before creating the distribution .tar.gz file:
  $ perl Makefile.PL
  $ make
  $ make test
    [the tests run with all the optional modules installed]
  $ perl -MDevel::Hide=-from:children,Module1,Module2,Module3,... \
      'exec("make test")'
    [the tests run without Module1, Module2 etc]

The '-from:children' switch works by populating $ENV{PERL5OPT} so that
when any child process runs perl, Devel::Hide is automatically loaded
and the right options passed to it.  This means that it isn't compatible
with Taint mode.

-- 
David Cantrell | Hero of the Information Age

"Every normal man must be tempted at times to spit on his hands,
 hoist the black flag, and begin slitting throats." -- H. L. Mencken

Reply via email to