summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AutoLoader.pm19
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 ($@) {