develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #90888] Using each @array as while iterator exits on first (0th) index

Thread Previous
From:
Father Chrysostomos via RT
Date:
June 24, 2013 13:24
Subject:
[perl #90888] Using each @array as while iterator exits on first (0th) index
Message ID:
rt-3.6.HEAD-2552-1372080228-883.90888-15-0@perl.org
On Fri Feb 15 18:39:02 2013, jkeenan wrote:
> On Tue May 24 20:14:26 2011, sprout wrote:
> > On Tue May 24 13:15:41 2011, am0c wrote:
> > > commit 329521539b6f17f285367182890c6b24a7fdf408
> > > Author: Hojung Yoon <amoc.yn@gmail.com>
> > > Date: � Wed May 25 03:41:53 2011 +0900
> > > 
> > > � �[perl #90888] each(ARRAY) on scalar context should wrapped into
> > >    defined()
> > > 
> > > � �"perldoc -f each" says that if each() is performed on ARRAY
> > > � �in scalar context, it will return only the index in an array.
> > > � �Calling each(HASH) in scalar context worked well but calling
> > > � �each(ARRAY) didn't because it was not wrapped into defined OPCODE.
> > > 
> > > � �So, in Perl_newWHILEOP() and Perl_newLOOPOP(), they are modified
> > > � �to check them and wrap with defined OP if needed.
> > > 
> > > � �In S_new_logop(), it's reasonable to warn if return value of
> > > � �each(ARRAY) is being used for boolean value, as it's first return
> > > � �value will be "0", the false.
> > > 
> > > � �issue: #90888
> > > � �link: http://rt.perl.org/rt3/Public/Bug/Display.html?id=90888
> > 
> > Thank you. Applied as 459b64d.
> > 
> > I’m leaving this ticket open, until each $scalar is addressed.
> 
> Does anyone know what it would take to handle the 'each $scalar' case?
> 
> Thank you very much.
> Jim Keenan

Probably checking for OP_REACH as well as OP_AEACH.

-- 

Father Chrysostomos


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

Thread Previous


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