summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-05-25 22:44:39 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-06-07 08:18:53 -0700
commitbf3d870f8b8accd379ab520c1ff1daa10317d27d (patch)
tree5146803b0bf1ed8f28a35e8c6728b09f1ab2710a /pp.c
parentf90b723246c15bceccd726b73c412184c27eca7d (diff)
downloadperl-bf3d870f8b8accd379ab520c1ff1daa10317d27d.tar.gz
Make strict refs report $1 the same way as "$1"
A magical variable is never SvPOK, but only SvPOKp. The code that determined whether to put an ellipsis mark after a truncated symbol name was only checking SvPOK, resulting in this discrepancy: $ perl5.15.9 -e 'use strict; *{"a"x40}' Can't use string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"...) as a symbol ref while "strict refs" in use at -e line 1. $ perl5.15.9 -e 'use strict; ("a"x40)=~/(.*)/; *{$1}' Can't use string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as a symbol ref while "strict refs" in use at -e line 1. $ perl5.15.9 -e 'use strict; ${"a"x40}' Can't use string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"...) as a SCALAR ref while "strict refs" in use at -e line 1. $ perl5.15.9 -e 'use strict; ("a"x40)=~/(.*)/; ${$1}' Can't use string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as a SCALAR ref while "strict refs" in use at -e line 1. SvPOK variables are also SvPOKp, so checking just the latter suffices.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 6e7544aaef..8d2ee2a935 100644
--- a/pp.c
+++ b/pp.c
@@ -218,7 +218,7 @@ S_rv2gv(pTHX_ SV *sv, const bool vivify_sv, const bool strict,
(SV *)Perl_die(aTHX_
S_no_symref_sv,
sv,
- (SvPOK(sv) && SvCUR(sv)>32 ? "..." : ""),
+ (SvPOKp(sv) && SvCUR(sv)>32 ? "..." : ""),
"a symbol"
);
if ((PL_op->op_private & (OPpLVAL_INTRO|OPpDONT_INIT_GV))
@@ -271,7 +271,8 @@ Perl_softref2xv(pTHX_ SV *const sv, const char *const what,
if (PL_op->op_private & HINT_STRICT_REFS) {
if (SvOK(sv))
- Perl_die(aTHX_ S_no_symref_sv, sv, (SvPOK(sv) && SvCUR(sv)>32 ? "..." : ""), what);
+ Perl_die(aTHX_ S_no_symref_sv, sv,
+ (SvPOKp(sv) && SvCUR(sv)>32 ? "..." : ""), what);
else
Perl_die(aTHX_ PL_no_usym, what);
}