Remove string eval from AUTOLOAD
authorJonathan Stowe <gellyfish@gellyfish.com>
Sat, 29 Sep 2001 15:52:43 +0000 (16:52 +0100)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 30 Sep 2001 00:31:07 +0000 (00:31 +0000)
Message-ID: <Pine.LNX.4.33.0109291535120.18586-100000@orpheus.gellyfish.com>

p4raw-id: //depot/perl@12277

ext/DB_File/DB_File.pm
ext/GDBM_File/GDBM_File.pm

index 1df9876..5ac1120 100644 (file)
@@ -222,8 +222,9 @@ sub AUTOLOAD {
 ";
        }
     }
-    eval "sub $AUTOLOAD { $val }";
-    goto &$AUTOLOAD;
+    no strict 'refs';
+    *{$AUTOLOAD} = sub { $val };
+    goto &{$AUTOLOAD};
 }
 
 
index 75bc7c1..63225f0 100644 (file)
@@ -67,8 +67,9 @@ sub AUTOLOAD {
     ($constname = $AUTOLOAD) =~ s/.*:://;
     my ($error, $val) = constant($constname);
     Carp::croak $error if $error;
-    eval "sub $AUTOLOAD { $val }";
-    goto &$AUTOLOAD;
+    no strict 'refs';
+    *{$AUTOLOAD} = sub { $val };
+    goto &{$AUTOLOAD};
 }
 
 XSLoader::load 'GDBM_File', $VERSION;