Optional Subclass Loading Problem

Tom Hukins tom at eborcom.com
Tue Jul 4 14:24:05 PDT 2006


On Tue, Jul 04, 2006 at 10:53:51AM +0100, Nik Clayton wrote:
> It doesn't solve the problem you pose, but could you work around it
> by having a test that does the equivalent of
> 
>      find . -name \*.pm | xargs perl -c

That's definitely a useful fallback, and something I've been thinking
about adding to our test suite along with Test::Strict some time.
Eventually.

> Ah, here's a thought.  You can check %INC after the use.  I've just
> done a quick test.

Those are definitely the droids I'm looking for.  Thanks.  I suspected
that thinking too much about $@ had caused me to miss out on other
ideas.

Of course, use() just wraps require() and import().  The documentation
for require() explains how it populates %INC:
http://perldoc.perl.org/functions/require.html

So, compilation errors shove undef in $INC{$filename}, whereas
non-existent files do "delete $INC{$filename}".  The documentation for
do() also helped me understand this:
http://perldoc.perl.org/functions/do.html

Cheers,
Happy Tom


More information about the MiltonKeynes-pm mailing list