summaryrefslogtreecommitdiff
path: root/lib/AutoLoader.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AutoLoader.pm')
-rw-r--r--lib/AutoLoader.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/AutoLoader.pm b/lib/AutoLoader.pm
index c45483b02d..2773a90f10 100644
--- a/lib/AutoLoader.pm
+++ b/lib/AutoLoader.pm
@@ -1,6 +1,5 @@
package AutoLoader;
-use Carp;
use vars qw(@EXPORT @EXPORT_OK);
BEGIN {
@@ -42,7 +41,9 @@ AUTOLOAD {
}
if ($@){
$@ =~ s/ at .*\n//;
- croak $@;
+ my $error = $@;
+ require Carp;
+ Carp::croak($error);
}
}
}
@@ -83,7 +84,11 @@ sub import {
$path ="auto/$calldir/autosplit.ix";
eval { require $path; };
}
- carp $@ if ($@);
+ if ($@) {
+ my $error = $@;
+ require Carp;
+ Carp::carp($error);
+ }
}
}
@@ -169,6 +174,7 @@ Instead, they should define their own AUTOLOAD subroutines along these
lines:
use AutoLoader;
+ use Carp;
sub AUTOLOAD {
my $constname;
@@ -183,7 +189,7 @@ lines:
croak "Your vendor has not defined constant $constname";
}
}
- eval "sub $AUTOLOAD { $val }";
+ *$AUTOLOAD = sub { $val }; # same as: eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
}