From: Jonathan Stowe Date: Sat, 29 Sep 2001 15:52:43 +0000 (+0100) Subject: Remove string eval from AUTOLOAD X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=57c778516574f3d031a85dcdab2d18deacee782a;p=p5sagit%2Fp5-mst-13.2.git Remove string eval from AUTOLOAD Message-ID: p4raw-id: //depot/perl@12277 --- diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm index 1df9876..5ac1120 100644 --- a/ext/DB_File/DB_File.pm +++ b/ext/DB_File/DB_File.pm @@ -222,8 +222,9 @@ sub AUTOLOAD { "; } } - eval "sub $AUTOLOAD { $val }"; - goto &$AUTOLOAD; + no strict 'refs'; + *{$AUTOLOAD} = sub { $val }; + goto &{$AUTOLOAD}; } diff --git a/ext/GDBM_File/GDBM_File.pm b/ext/GDBM_File/GDBM_File.pm index 75bc7c1..63225f0 100644 --- a/ext/GDBM_File/GDBM_File.pm +++ b/ext/GDBM_File/GDBM_File.pm @@ -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;