summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>1999-05-12 03:01:00 +0200
committerGurusamy Sarathy <gsar@cpan.org>1999-05-12 08:56:03 +0000
commitaa854799af20b80973df4e295167b2fda1fc7a9c (patch)
tree739f9e249eb28f55d70a74e096f695c94607daa0 /doop.c
parent23db2e2d7afc6848cb8a7718eb161f0d24b03858 (diff)
downloadperl-aa854799af20b80973df4e295167b2fda1fc7a9c.tar.gz
chop/chomp modify readonly values
Message-ID: <3741b5e8.20386944@smtp1.ibm.net> p4raw-id: //depot/perl@3397
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/doop.c b/doop.c
index ccabba1357..0142710a14 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);