Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Sys-Mmap CPAN distribution.

Report information
The Basics
Id: 59754
Status: resolved
Priority: 0/
Queue: Sys-Mmap

People
Owner: TODDR [...] cpan.org
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.13
Fixed in: 0.13_01



Subject: AUTOLOAD does quoted eval.
AUTOLOAD does a quoted eval to setup constants for this module. This is discouraged. perldoc recommends an alternative approach now. http://perldoc.perl.org/AutoLoader.html
The attached patch corrects this situation.
Subject: patch.txt
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; }
This has been resolved in 0.13_01