Subject: | uninit $RULE when no import |
Date: | Wed, 27 May 2009 09:52:16 +1000 |
To: | bug-Test-UseAllModules [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
In Test::UseAllModules 0.11 with the debian packaged perl 5.10.0, the
program foo.t below gets an error
Use of uninitialized value $RULE in regexp compilation at /usr/share/perl5/Test\/UseAllModules.pm line 38.
I'd been using this "require" style to run Test::UseAllModules if
installed, or skip if not. It was ok with 0.10, I wonder if it could
continue to work.
I don't need to specify an "under" option, so if $RULE defaulted to
'lib' or whatever that would be enough. I imagine I could "eval 'use
Test::UseAllModules'", but I think it's usually cleanest for modules not
to depend on their import() having run, at least for plain non-pragma
modules, if you know what I mean.
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
if (eval { require Test::UseAllModules }) {
Test::UseAllModules::all_uses_ok (except => qw(Some::Dependent::Module
Another::Dependent::Module
^Yet::Another::Dependent::.*
));
}
exit 0;