diff options
author | Leon Timmermans <fawaka@gmail.com> | 2011-02-17 18:04:00 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-02-17 18:28:58 -0800 |
commit | 0a0b6c96e6042658aa123b3990724be593a2bb63 (patch) | |
tree | 726442ff53b1055fea414c4a58b8130a7c4944ab | |
parent | d488af49a24e1d0cc601b18ecc8722114e5a97c8 (diff) | |
download | perl-0a0b6c96e6042658aa123b3990724be593a2bb63.tar.gz |
[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.
-rw-r--r-- | ext/DynaLoader/DynaLoader_pm.PL | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL index a86557e6d6..9ea8343d70 100644 --- a/ext/DynaLoader/DynaLoader_pm.PL +++ b/ext/DynaLoader/DynaLoader_pm.PL @@ -88,9 +88,6 @@ BEGIN { $VERSION = '1.12'; } -require AutoLoader; -*AUTOLOAD = \&AutoLoader::AUTOLOAD; - use Config; # enable debug/trace messages from DynaLoader perl code @@ -389,19 +386,6 @@ sub bootstrap { &$xs(@args); } - -#sub _check_file { # private utility to handle dl_expandspec vs -f tests -# my($file) = @_; -# return $file if (!$do_expand && -f $file); # the common case -# return $file if ( $do_expand && ($file=dl_expandspec($file))); -# return undef; -#} - - -# Let autosplit and the autoloader deal with these functions: -__END__ - - sub dl_findfile { # Read ext/DynaLoader/DynaLoader.doc for detailed information. # This function does not automatically consider the architecture @@ -538,6 +522,8 @@ sub dl_find_symbol_anywhere return undef; } +__END__ + =head1 NAME DynaLoader - Dynamically load C libraries into Perl code |