From 0a0b6c96e6042658aa123b3990724be593a2bb63 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Thu, 17 Feb 2011 18:04:00 -0800 Subject: [PATCH] [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 | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL index a86557e..9ea8343 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 -- 2.7.4