Adam Kennedy wrote:
> Out of curiosity John, why would need to do an automatic run-time
> module load at all?

It is to replicate some longstanding UNIVERSAL::VERSION behavior; there are
things that I can do in XS that are nearly impossible to replicate any other way
in pure Perl.  I have some test improvements that will make it clearer, but the
issue is the inability from pure Perl to distinguish between a "module" that
doesn't have a 'package' line from one that doesn't exist at all.  Perl's own
UNIVERSAL::VERSION is perfectly happy to be called on an unloaded class:


$ perl5.8.9 -we 'print Completely::Fictitious::Class::Name->VERSION'
Use of uninitialized value in print at -e line 1.

Note that the warning is merely that the ->VERSION method returns undef.  That
turned out to be surprisingly difficult to distinguish from the case where the
class is missing a 'package' declaration:

$ cat Dumb.pm
# no package here.
# nor $VERSION

1;

John

Reply via email to