perl5.001 patch.1f
[p5sagit/p5-mst-13.2.git] / lib / AutoLoader.pm
CommitLineData
8990e307 1package AutoLoader;
a0d0e21e 2use Carp;
8990e307 3
4AUTOLOAD {
5 my $name = "auto/$AUTOLOAD.al";
6 $name =~ s#::#/#g;
7 eval {require $name};
8 if ($@) {
a0d0e21e 9 # The load might just have failed because the filename was too
10 # long for some old SVR3 systems which treat long names as errors.
11 # If we can succesfully truncate a long name then it's worth a go.
12 # There is a slight risk that we could pick up the wrong file here
13 # but autosplit should have warned about that when splitting.
14 if ($name =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){
15 eval {require $name};
16 }
748a9306 17 elsif ($AUTOLOAD =~ /::DESTROY$/) {
18 eval "sub $AUTOLOAD {}";
19 }
a0d0e21e 20 if ($@){
21 $@ =~ s/ at .*\n//;
22 croak $@;
23 }
8990e307 24 }
25 goto &$AUTOLOAD;
26}
27
281;