Your message dated Sat, 15 Mar 2008 20:53:12 +0200
with message-id <[EMAIL PROTECTED]>
and subject line Re: Bug#447319: perl: foreach ($i = grep { ... } @foo) { warn; 
} strange results
has caused the Debian Bug report #447319,
regarding perl: foreach ($i = grep { ... } @foo) { warn; } strange results
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
447319: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=447319
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: perl
Version: 5.8.8-11
Severity: normal


warn without arguments inside a foreach { grep } loop
causes bad things to happen. Test program followed by output:

#!/usr/bin/perl -w
use strict;

# set to 1 to break or 0 to work
my $crash = 1;

my @list = qw/A b C/;
my @loh = map { { name => $_ } } @list;

foreach my $i (grep({ $_->{name} =~ m/[A-Z]/ } @loh)) {
    # this should print out got HASH(...) twice - once for A and once for C
    print "got $i\n";
    # This shouldn't happen, but it does if $crash=1?!
    die "$i is not a hash ref!" if (ref($i) ne 'HASH');

    if ($crash) {
        # this warn seems to screw with the thing that will be the next $i?
        warn;
    } else {
        warn "false alarm, everything is OK";
    }
}



What I get:
[EMAIL PROTECTED] perl broken.pl
got HASH(0x604160)
Warning: something's wrong at broken.pl line 17.
got 1
1 is not a hash ref! at broken.pl line 13.
[EMAIL PROTECTED]

what I expect:
[EMAIL PROTECTED] perl broken.pl
got HASH(0x604160)
Warning: something's wrong at broken.pl line 17.
got HASH(0x628a10)
Warning: something's wrong at broken.pl line 17.
[EMAIL PROTECTED]

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages perl depends on:
ii  libc6                         2.6.1-6    GNU C Library: Shared libraries
pn  libdb4.6                      <none>     (no description available)
ii  libgdbm3                      1.8.3-3    GNU dbm database routines (runtime
ii  perl-base                     5.8.8-11.1 The Pathologically Eclectic Rubbis
pn  perl-modules                  <none>     (no description available)

Versions of packages perl recommends:
ii  perl-doc                      5.8.8-11   Perl documentation

-- no debconf information



--- End Message ---
--- Begin Message ---
Version: 5.10.0-1

On Fri, Oct 19, 2007 at 05:32:04PM -0700, Rex Feany wrote:
> Package: perl
> Version: 5.8.8-11
> Severity: normal
 
> warn without arguments inside a foreach { grep } loop
> causes bad things to happen.

This is fixed in Perl 5.10.0, currently in experimental. 
>From the changelog:

[ 30513] By: rgs                                   on 2007/03/08  11:19:38
        Log: Need to extend the stack when using warn() without
             an argument (this fixes bug #41716)
     Branch: perl
           ! pp_sys.c

Closing accordingly.

Cheers,
-- 
Niko Tyni   [EMAIL PROTECTED]


--- End Message ---

Reply via email to