The attached patch corrects this situation.
commit 6e62df1c4036100f4e6109394b6cc61f75057ae9
Author: Todd Rinaldo <toddr@cpan.org>
Date: Tue Jul 27 22:41:01 2010 -0500
RT 59754 - AUTOLOAD does quoted eval.
diff --git a/Mmap.pm b/Mmap.pm
index e2a8b0a..da98f9a 100644
--- a/Mmap.pm
+++ b/Mmap.pm
@@ -271,20 +271,25 @@ sub AUTOLOAD {
# XS function. If a constant is not found then control is passed
# to the AUTOLOAD in AutoLoader.
- my $constname;
- ($constname = $AUTOLOAD) =~ s/.*:://;
+ if ($AUTOLOAD =~ /::(_?[a-z])/) {
+ $AutoLoader::AUTOLOAD = $AUTOLOAD;
+ goto &AutoLoader::AUTOLOAD;
+ }
+
+ local $! = 0;
+ my $constname = $AUTOLOAD;
+ $constname =~ s/.*:://;
+ return if $constname eq 'DESTROY';
my $val = constant($constname, @_ ? $_[0] : 0);
- if ($! != 0) {
- if ($! =~ /Invalid/) {
- $AutoLoader::AUTOLOAD = $AUTOLOAD;
- goto &AutoLoader::AUTOLOAD;
- }
- else {
- require Carp;
- Carp::croak("Your vendor has not defined Mmap macro $constname");
- }
+ if ($! == 0) {
+ no strict 'refs';
+ *$AUTOLOAD = sub { $val };
}
- eval "sub $AUTOLOAD { $val }";
+ else {
+ require Carp;
+ Carp::croak("Your vendor has not defined Mmap macro $constname");
+ }
+
goto &$AUTOLOAD;
}