develooper Front page | perl.perl5.porters | Postings from August 2010

[PATCH] Re: [perl #77496] tied gets scalars and globs confused

From:
Father Chrysostomos
Date:
August 29, 2010 13:43
Subject:
[PATCH] Re: [perl #77496] tied gets scalars and globs confused
Message ID:
EFACCC76-F2CF-4B76-9096-2028490EE770@cpan.org

On Aug 29, 2010, at 1:38 PM, Father Chrysostomos wrote:

> In trying to write a test for an assignment bug, I came across this anomaly with tied():
> 
> sub TIESCALAR {bless[]}
> sub FETCH { 1 }
> sub STORE{}
> tie $rin, "";
> $rin = *rin;
> print qw[good bad][!tied $rin];
> 
> tied returns undef, so this prints ‘bad’. tied checks first to see whether its argument is a glob. If it is, it returns undef if the IO slot is empty.
> 
> So the the tiedness, according to tied(), varies depending on what the last value happened to be that was returned or assigned.

There should be a patch attached hereto. I put the explanation of OPf_SPECIAL above OP_HELEM to avoid a conflict with the patch for bug #20444.




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