3 $DB::sub = $DB::sub; # Avoid warning
7 AutoLoader - load functions only on demand
14 @ISA = (Exporter, AutoLoader);
18 This module tells its users that functions in the FOOBAR package are to be
19 autoloaded from F<auto/$AUTOLOAD.al>. See L<perlsub/"Autoloading">.
24 my $name = "auto/$AUTOLOAD.al";
28 # The load might just have failed because the filename was too
29 # long for some old SVR3 systems which treat long names as errors.
30 # If we can succesfully truncate a long name then it's worth a go.
31 # There is a slight risk that we could pick up the wrong file here
32 # but autosplit should have warned about that when splitting.
33 if ($name =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){
36 elsif ($AUTOLOAD =~ /::DESTROY$/) {
37 # eval "sub $AUTOLOAD {}";
45 $DB::sub = $AUTOLOAD; # Now debugger know where we are.
50 my ($callclass, $callfile, $callline,$path,$callpack) = caller(0);
51 ($callpack = $callclass) =~ s#::#/#;
52 # Try to find the autosplit index file. Eg., if the call package
53 # is POSIX, then $INC{POSIX.pm} is something like
54 # '/usr/local/lib/perl5/POSIX.pm', and the autosplit index file is in
55 # '/usr/local/lib/perl5/auto/POSIX/autosplit.ix', so we require that.
57 # However, if @INC is a relative path, this might not work. If,
58 # for example, @INC = ('lib'), then
59 # $INC{POSIX.pm} is 'lib/POSIX.pm', and we want to require
60 # 'auto/POSIX/autosplit.ix' (without the leading 'lib').
62 if (defined($path = $INC{$callpack . '.pm'})) {
63 # Try absolute path name.
64 $path =~ s#^(.*)$callpack\.pm$#$1auto/$callpack/autosplit.ix#;
65 eval { require $path; };
66 # If that failed, try relative path with normal @INC searching.
68 $path ="auto/$callpack/autosplit.ix";
69 eval { require $path; };