diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-06-06 23:19:47 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-06-07 08:18:55 -0700 |
commit | b1d0a83378b21d719f9e1fd57b852ca875a7c228 (patch) | |
tree | 05a5fbcb06aa56bd3f6618367888e04e95366825 | |
parent | 288163b0396d677d915ce0beb12619dc26646926 (diff) | |
download | perl-b1d0a83378b21d719f9e1fd57b852ca875a7c228.tar.gz |
Make warn treat $@=3 and $@="3" the same
If we get this:
$ ./perl -Ilib -e '$@ = "3"; warn'
3 ...caught at -e line 1.
then we shouldn’t get this:
$ ./perl -Ilib -e '$@ = 3; warn'
Warning: something's wrong at -e line 1.
as the two scalars hold the same value.
-rw-r--r-- | pp_sys.c | 2 | ||||
-rw-r--r-- | t/op/warn.t | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -453,7 +453,7 @@ PP(pp_warn) } else exsv = ERRSV; } - else if (SvPOKp(ERRSV) && SvCUR(ERRSV)) { + else if (SvPOKp(ERRSV) ? SvCUR(ERRSV) : SvNIOKp(ERRSV)) { exsv = sv_newmortal(); sv_setsv_nomg(exsv, ERRSV); sv_catpvs(exsv, "\t...caught"); diff --git a/t/op/warn.t b/t/op/warn.t index a0a072e247..71de5e2cca 100644 --- a/t/op/warn.t +++ b/t/op/warn.t @@ -7,7 +7,7 @@ BEGIN { require './test.pl'; } -plan 28; +plan 30; my @warnings; my $wa = []; my $ea = []; @@ -186,4 +186,10 @@ is @warnings, 1; object_ok $warnings[0], 'o', 'warn $tie_returning_object_that_stringifes_emptily'; +@warnings = (); +eval "#line 42 Cholmondeley\n \$\@ = '3'; warn"; +eval "#line 42 Cholmondeley\n \$\@ = 3; warn"; +is @warnings, 2; +is $warnings[1], $warnings[0], 'warn treats $@=3 and $@="3" the same way'; + 1; |