diff options
author | Nick Ing-Simmons <nick@ni-s.u-net.com> | 1996-11-23 19:54:52 +0000 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1996-11-30 05:31:00 +1200 |
commit | 5a556d178903eb73ed2e240fee34fcfc607b2bb3 (patch) | |
tree | 31200a4f6ca8c787e7fbec0540bceb5ef2a762b5 /lib | |
parent | a872576ee6aa31d9823ddc040f76ea30e4ad9609 (diff) | |
download | perl-5a556d178903eb73ed2e240fee34fcfc607b2bb3.tar.gz |
AutoLoader::AUTOLOAD optimization
I notice that although *.al are right alongside autosplit.ix the
trick AutoLoader::import uses to speed looking for the latter
is not used to find the *.al files - anyone know why?
On NFS mounted file systems at least, all the failed stats/opens are expensive.
(Sadly I am testing this at home where everything is local...)
p5p-msgid: <199611231954.TAA09921@ni-s.u-net.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AutoLoader.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/AutoLoader.pm b/lib/AutoLoader.pm index fa9a322449..be6429e6e8 100644 --- a/lib/AutoLoader.pm +++ b/lib/AutoLoader.pm @@ -98,9 +98,22 @@ conflicts when used to split a module. =cut AUTOLOAD { - my $name = "auto/$AUTOLOAD.al"; - # Braces used on the s/// below to preserve $1 et al. - {$name =~ s#::#/#g} + my $name; + # Braces used to preserve $1 et al. + { + my ($pkg,$func) = $AUTOLOAD =~ /(.*)::([^:]+)$/; + $pkg =~ s#::#/#g; + if (defined($name=$INC{"$pkg.pm"})) + { + $name =~ s#^(.*)$pkg\.pm$#$1auto/$pkg/$func.al#; + $name = undef unless (-r $name); + } + unless (defined $name) + { + $name = "auto/$AUTOLOAD.al"; + $name =~ s#::#/#g; + } + } my $save = $@; eval {require $name}; if ($@) { |