develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [PATCH] Perl_croak("Use of freed value in iteration")

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
April 21, 2003 05:54
Subject:
Re: [PATCH] Perl_croak("Use of freed value in iteration")
Message ID:
20030421125433.GC18189@fdgroup.com
On Mon, Apr 21, 2003 at 02:34:59PM +0200, Rafael Garcia-Suarez wrote:
> Why do you need a fresh perl ?
> eval {} should be sufficient (once the bug is fixed ;-)

Ah yes. Silly me.

-- 
But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. - "Bored of the Rings"


--- t/cmd/for.t-	Mon Apr 21 13:47:55 2003
+++ t/cmd/for.t	Mon Apr 21 13:52:09 2003
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..12\n";
+print "1..13\n";
 
 for ($i = 0; $i <= 10; $i++) {
     $x[$i] = $i;
@@ -71,3 +71,8 @@
     $loop_count++;
 }
 print $loop_count == 4 ? "ok" : "not ok", " 12\n";
+
+# modifying arrays in loops is a no-no
+@a = (3,4);
+eval { @a = () for (1,2,@a) };
+print $@ =~ /Use of freed value in iteration/ ? "ok" : "not ok", " 13\n";

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About