X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FAutoLoader.pm;h=3f5eef2375d64f76bfa25921413e845ea92a5d07;hb=42793c05a05499f6592114920af255acb5944481;hp=dba8ca2f5fb1617497df7ed91d27f1f8b212f389;hpb=8990e3071044a96302560bbdb5706f3e74cf1bef;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/AutoLoader.pm b/lib/AutoLoader.pm index dba8ca2..3f5eef2 100644 --- a/lib/AutoLoader.pm +++ b/lib/AutoLoader.pm @@ -1,13 +1,23 @@ package AutoLoader; +use Carp; AUTOLOAD { my $name = "auto/$AUTOLOAD.al"; $name =~ s#::#/#g; eval {require $name}; if ($@) { - ($p,$f,$l) = caller($AutoLevel); - $@ =~ s/ at .*\n//; - die "$@ at $f line $l\n"; + # The load might just have failed because the filename was too + # long for some old SVR3 systems which treat long names as errors. + # If we can succesfully truncate a long name then it's worth a go. + # There is a slight risk that we could pick up the wrong file here + # but autosplit should have warned about that when splitting. + if ($name =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){ + eval {require $name}; + } + if ($@){ + $@ =~ s/ at .*\n//; + croak $@; + } } goto &$AUTOLOAD; }