[perl #84358] Removing AutoLoader from DynaLoader
authorLeon Timmermans <fawaka@gmail.com>
Fri, 18 Feb 2011 02:04:00 +0000 (18:04 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 18 Feb 2011 02:28:58 +0000 (18:28 -0800)
commit0a0b6c96e6042658aa123b3990724be593a2bb63
tree726442ff53b1055fea414c4a58b8130a7c4944ab
parentd488af49a24e1d0cc601b18ecc8722114e5a97c8
[perl #84358] Removing AutoLoader from DynaLoader

DynaLoader currently uses Autoloader. This was an optimization going
back to perl 5.000 in 1994. However, this implementation detail leaks in
a rather troublesome way.

DynaLoader is used by subclassing it. Because of this, when you call
some undefined method on an instance of any class that derives from
DynaLoader (directly or indirectly) you do not get this error message:

    Can't locate object method "undefined_method" via package "Foo"

But this rather cryptic error:

    Can't locate auto/Foo/undefined_m.al in @INC (@INC contains:
/etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10
/usr/local/lib/site_perl .)

This is totally incomprehensible for anyone who isn't familiar with
what's going on. It was rather a premature optimization anyway if you
ask me, on my machine it's just 66 non-empty lines of code that are
being autoloaded.

Therefore, I think AutoLoader should be removed from DynaLoader.
ext/DynaLoader/DynaLoader_pm.PL