New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CGI.pm "autoloading" loses $@ #7370
Comments
From perl-5.8.0@ton.iguana.beCreated by perl-5.8.0@ton.iguana.beperl -wle 'use CGI qw/:standard/; (prints nothing) perl -wle 'use CGI qw/:standard/; escapeHTML(); Perl Info
|
From @hvds"perl-5.8.0@ton.iguana.be (via RT)" <perlbug-followup@perl.org> wrote: In general, random subroutines that you call may do something (ie C<eval>) It is difficult to know how to document that without forcing every Hugo |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Thu, Jun 17, 2004 at 03:11:57PM +0100, hv@crypt.org wrote:
However, core perl Autoload.pm was regarded as buggy when it changed $@ as Nicholas Clark |
From @schwernOn Thu, Jun 17, 2004 at 03:15:23PM +0100, Nicholas Clark wrote:
You can defend against this sort of thing by localizing $@ before using CGI.pm only has two significant ones in _compile. Patch attached. -- |
From @schwerncgi_eval.patch--- ./CGI.pm 2004/07/08 15:28:42 1.1
+++ ./CGI.pm 2004/07/08 15:28:56
@@ -759,6 +759,7 @@
my($sub) = \%{"$pack\:\:SUBS"};
unless (%$sub) {
my($auto) = \${"$pack\:\:AUTOLOADED_ROUTINES"};
+ local($@,$!);
eval "package $pack; $$auto";
croak("$AUTOLOAD: $@") if $@;
$$auto = ''; # Free the unneeded storage (but don't undef it!!!)
@@ -777,6 +778,7 @@
}
}
croak("Undefined subroutine $AUTOLOAD\n") unless $code;
+ local($@,$!);
eval "package $pack; $code";
if ($@) {
$@ =~ s/ at .*\n//;
--- ./t/eval.t 2004/07/08 15:32:00 1.1
+++ ./t/eval.t 2004/07/08 15:32:04
@@ -0,0 +1,11 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More tests => 2;
+
+use CGI ':standard';
+
+$@ = "foo";
+$! = 42;
+is escapeHTML($@), 'foo', '_compile does not interfere with $@';
+cmp_ok escapeHTML($!), '==', 42, '_compile does not interfere with $!';
|
From lstein@cshl.eduThanks! That'll go into 3.06. Lincoln On Thursday 08 July 2004 11:33 am, Michael G Schwern wrote:
-- |
From @smpeters
And so it has. This ticket is resolved. |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#30325 (status was 'resolved')
Searchable as RT30325$
The text was updated successfully, but these errors were encountered: