From: Vincent Pit Date: Thu, 15 May 2008 15:31:19 +0000 (+0200) Subject: Re: [PATCH] Double magic with chop X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e968d83d8ff249abd1f06a7f900eea6b8c3fc51;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] Double magic with chop From: "Vincent Pit" Message-ID: <32964.147.210.17.175.1210858279.squirrel@147.210.17.175> p4raw-id: //depot/perl@33831 --- diff --git a/doop.c b/doop.c index 8bd7c0f..8bff60a 100644 --- a/doop.c +++ b/doop.c @@ -1033,7 +1033,7 @@ Perl_do_chop(pTHX_ register SV *astr, register SV *sv) s = SvPV(sv, len); if (len && !SvPOK(sv)) - s = SvPV_force(sv, len); + s = SvPV_force_nomg(sv, len); if (DO_UTF8(sv)) { if (s && len) { char * const send = s + len; diff --git a/t/op/gmagic.t b/t/op/gmagic.t index ab6d2ee..ce05aff 100644 --- a/t/op/gmagic.t +++ b/t/op/gmagic.t @@ -6,7 +6,7 @@ BEGIN { @INC = '../lib'; } -print "1..18\n"; +print "1..20\n"; my $t = 1; tie my $c => 'Tie::Monitor'; @@ -50,6 +50,10 @@ ok_string($s, 'x0', 2, 1); $s = $c = $c . $c; ok_string($s, '00', 3, 1); +# multiple magic in core functions +$s = chop($c); +ok_string($s, '0', 1, 1); + # adapted from Tie::Counter by Abigail package Tie::Monitor;