From: Jan Dubois Date: Wed, 12 May 1999 01:01:00 +0000 (+0200) Subject: chop/chomp modify readonly values X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aa854799af20b80973df4e295167b2fda1fc7a9c;p=p5sagit%2Fp5-mst-13.2.git chop/chomp modify readonly values Message-ID: <3741b5e8.20386944@smtp1.ibm.net> p4raw-id: //depot/perl@3397 --- diff --git a/doop.c b/doop.c index ccabba1..0142710 100644 --- a/doop.c +++ b/doop.c @@ -779,7 +779,7 @@ do_chop(register SV *astr, register SV *sv) } return; } - if (SvTYPE(sv) == SVt_PVHV) { + else if (SvTYPE(sv) == SVt_PVHV) { HV* hv = (HV*)sv; HE* entry; (void)hv_iterinit(hv); @@ -788,6 +788,8 @@ do_chop(register SV *astr, register SV *sv) do_chop(astr,hv_iterval(hv,entry)); return; } + else if (SvREADONLY(sv)) + croak(no_modify); s = SvPV(sv, len); if (len && !SvPOK(sv)) s = SvPV_force(sv, len); @@ -846,7 +848,7 @@ do_chomp(register SV *sv) } return count; } - if (SvTYPE(sv) == SVt_PVHV) { + else if (SvTYPE(sv) == SVt_PVHV) { HV* hv = (HV*)sv; HE* entry; (void)hv_iterinit(hv); @@ -855,6 +857,8 @@ do_chomp(register SV *sv) count += do_chomp(hv_iterval(hv,entry)); return count; } + else if (SvREADONLY(sv)) + croak(no_modify); s = SvPV(sv, len); if (len && !SvPOKp(sv)) s = SvPV_force(sv, len);