summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-23 14:36:46 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-23 14:36:46 -0700
commitce74145d973236b7a56fe8a090468f4c688c9062 (patch)
tree4dada5041d8537b9ad89701a2a67d7cc473d4ad2 /pp.c
parented996e63f61a7ee2456fa3c26c7ab5d12fae3e1e (diff)
downloadperl-ce74145d973236b7a56fe8a090468f4c688c9062.tar.gz
close($undef) should not croak_no_modify
Commit ac53db4c3f7e fixed bug #31767 (open $1 not dying), but put the SvREADONLY check in the wrong spot, causing this bug: $ perl -lwe 'no warnings "once"; close $x; close $+' Name "main::x" used only once: possible typo at -e line 1. Use of uninitialized value $x in ref-to-glob cast at -e line 1. Modification of a read-only value attempted at -e line 1. It shouldn’t be dying if I’m not trying to modifying it.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index e60f7dba0e..865001b9a4 100644
--- a/pp.c
+++ b/pp.c
@@ -169,10 +169,10 @@ PP(pp_rv2gv)
/* If this is a 'my' scalar and flag is set then vivify
* NI-S 1999/05/07
*/
- if (SvREADONLY(sv))
- Perl_croak_no_modify(aTHX);
if (PL_op->op_private & OPpDEREF) {
GV *gv;
+ if (SvREADONLY(sv))
+ Perl_croak_no_modify(aTHX);
if (cUNOP->op_targ) {
STRLEN len;
SV * const namesv = PAD_SV(cUNOP->op_targ);