summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2012-05-25 02:44:20 -0300
committerFather Chrysostomos <sprout@cpan.org>2012-05-25 08:28:54 -0700
commit760209f8136cbd716bfb8a01d6911547c2dc9f1e (patch)
treed6313e854fdfd6401d69b707039853a27f10924d
parent2a53d3314d380af5ab5283758219417c6dfa36e9 (diff)
downloadperl-760209f8136cbd716bfb8a01d6911547c2dc9f1e.tar.gz
Fix for [perl #8931], call magic only once for join's first arg.
-rw-r--r--doop.c2
-rw-r--r--t/op/tie.t18
2 files changed, 19 insertions, 1 deletions
diff --git a/doop.c b/doop.c
index a562536bbb..1bd16b5e66 100644
--- a/doop.c
+++ b/doop.c
@@ -720,7 +720,7 @@ Perl_do_join(pTHX_ register SV *sv, SV *delim, register SV **mark, register SV *
if (delimlen) {
for (; items > 0; items--,mark++) {
- sv_catsv(sv,delim);
+ sv_catsv_nomg(sv,delim);
sv_catsv(sv,*mark);
}
}
diff --git a/t/op/tie.t b/t/op/tie.t
index 9301bb33a6..fcbf7a5830 100644
--- a/t/op/tie.t
+++ b/t/op/tie.t
@@ -1259,3 +1259,21 @@ $h{i}{j} = 'k';
print $h{i}{j}, "\n";
EXPECT
k
+########
+
+# [perl #8931] FETCH for tied $" called an odd number of times.
+use strict;
+my $i = 0;
+sub A::TIESCALAR {bless [] => 'A'}
+sub A::FETCH {print ++ $i, "\n"}
+my @a = ("", "", "");
+
+tie $" => 'A';
+"@a";
+
+$i = 0;
+tie my $a => 'A';
+join $a, 1..10;
+EXPECT
+1
+1