develooper Front page | perl.perl5.porters | Postings from May 2012

[perl #8931] FETCH for tied $" called an odd number of times.

Thread Previous | Thread Next
From:
Brian Fraser via RT
Date:
May 24, 2012 22:51
Subject:
[perl #8931] FETCH for tied $" called an odd number of times.
Message ID:
rt-3.6.HEAD-7788-1337925105-1572.8931-15-0@perl.org
On Fri Apr 12 00:54:59 2002, RT_System wrote:
> On Fri, Apr 12, 2002 at 04:32:02PM +0200, rgarciasuarez@free.fr wrote:
> >
> > (or should this be skipped by default ? are obfuscated
> > regression tests that useful ?)
> 
> I think the advantage of "obfuscated" tests is that they combine
> features in a surprising way. 
> 
> The test suite probably checks whether $" works as intended,
> it also tests whether tieing works correctly. But it's the
> combination that failed here: $" being tied to a function
> with side effects. 
> 
> 
> 
> Abigail
> 

Actually, it's worse than that:

my $i = 0;
sub A::TIESCALAR {bless [] => 'A'}
sub A::FETCH {print ++ $i, "\n"}

tie my $a => 'A';
join $a, 1..10;

Will call $a's magic for every element. So it's not tie+$", but tie+join
that are broken. Weird that this ticket ended up creating a whole new
section of the test suite, but didn't get the issue fixed, eh?
In any case, the attached patch seems to do the trick. It's just one
line, which probably means that it's broken somehow.

--hugmeir


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=8931

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