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
'no warnings' effects $@. #8957
Comments
From @AbigailCreated by @AbigailIt seem that sometimes that if one uses eval STRING, while warnings are For instance: $ perl -we 'eval "/ /a;"; print "[$@]\n";' The first three lines are (separate) warnings. The last line (syntax error...) So far, so good. But now look what happens if we turn warnings off: $ perl -Xe 'eval "/ /a;"; print "[$@]\n";' No warnings get emitted, but the first warning (Bareword found...) is now This is certainly unexpected, and, IMO, a bug. This happens in both maint and blead. And the same happens if one turns "But you should always run with warnings on", someone is bound to say. Perl Info
|
From rick@bort.caOn Jul 04 2007, Abigail wrote:
Patch attached. -- |
From rick@bort.ca43545.patchdiff -pruN perl-current/t/op/eval.t perl-current-dev/t/op/eval.t
--- perl-current/t/op/eval.t 2006-11-02 12:39:26.000000000 -0500
+++ perl-current-dev/t/op/eval.t 2007-07-07 22:43:20.000000000 -0400
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..93\n";
+print "1..94\n";
eval 'print "ok 1\n";';
@@ -455,6 +455,13 @@ print "ok $test - eval and last\n"; $tes
local $@ = "foo";
eval undef;
print "not " unless $@ eq "";
- print "ok $test # eval unef \n"; $test++;
+ print "ok $test # eval undef \n"; $test++;
+}
+
+{
+ no warnings;
+ eval "/ /a;";
+ print "not " unless $@ =~ /^syntax error/;
+ print "ok $test # eval syntax error, no warnings \n"; $test++;
}
diff -pruN perl-current/toke.c perl-current-dev/toke.c
--- perl-current/toke.c 2007-07-07 04:10:45.000000000 -0400
+++ perl-current-dev/toke.c 2007-07-07 22:42:42.000000000 -0400
@@ -12540,8 +12540,10 @@ Perl_yyerror(pTHX_ const char *s)
(int)PL_multi_open,(int)PL_multi_close,(IV)PL_multi_start);
PL_multi_end = 0;
}
- if (PL_in_eval & EVAL_WARNONLY && ckWARN_d(WARN_SYNTAX))
- Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "%"SVf, SVfARG(msg));
+ if (PL_in_eval & EVAL_WARNONLY) {
+ if (ckWARN_d(WARN_SYNTAX))
+ Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "%"SVf, SVfARG(msg));
+ }
else
qerror(msg);
if (PL_error_count >= 10) {
|
The RT System itself - Status changed from 'new' to 'open' |
From @rgsGood catch. Thanks, applied. |
From [Unknown Contact. See original ticket]Good catch. Thanks, applied. |
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#43545 (status was 'resolved')
Searchable as RT43545$
The text was updated successfully, but these errors were encountered: