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

Re: FYI - PM posted about a horrible List::Util::first bug

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
May 27, 2015 15:37
Subject:
Re: FYI - PM posted about a horrible List::Util::first bug
Message ID:
20150527153719.GP15483@iabyn.com
On Wed, May 27, 2015 at 03:34:18PM +0100, Zefram wrote:
> Dave Mitchell wrote:
> >So I don' think that condition is strong enough, and I'm not sure that
> >that there is such a safe condition.
> 
> Clearly it needs to exclude COWs.  Is it any worse than that?


Yes.

    use List::Util qw{ first };
    my $a = "A";
    use Devel::Peek;
    print first { lc $_ eq 'ab' } $a . "B";

prints "ab". $_ on entry to pp_lc() is:

    SV = PV(0xa8aca8) at 0xa8a138
      REFCNT = 1
      FLAGS = (TEMP,POK,pPOK)
      PV = 0xab03a8 "AB"\0
      CUR = 2
      LEN = 10


-- 
You never really learn to swear until you learn to drive.

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