[perl #47305] Problem with nested sub's  # New Ticket Created by  Alexandre Gorobets 
# Please include the string:  [perl #47305]
# in the subject line of all future correspondence about this issue. 
# 


This is a bug report for perl from xjqruiieb.xmsgkcgx@gmail.com,
generated with the help of perlbug 1.35 running under perl v5.8.4.

-----------------------------------------------------------------
[Please enter your report here]

use strict;
use warnings;

my %Instances;

package ZombyTest;

sub new {
    my $class = shift;
    my $name  = shift;

    $Instances{ $name }++;

    return bless \\$name;
}

sub DESTROY {
    my $self = shift;

    $Instances{ $$self }--;
};

# Test 1 - it's OK - silly check ;)
{
    my $test_1 = new ZombyTest( 'test_1' );
};

warn "test_1 is ", $Instances{'test_1'} ? 'zomby' : 'died';

# Test 2 - it's OK
{
    my $test_2 = new ZombyTest( 'test_2' );

    my $sub1 = sub {
        print $test_2;
    };
};

warn "test_2 is ", $Instances{'test_2'} ? 'zomby' : 'died';

# Test 3 - it's OK too ... why not ;)
{
    my $test_3 = new ZombyTest( 'test_3' );

    my $sub_1 = sub {
        print $test_3;
        my $sub_2 = sub {};
    };
};

warn "test_3 is ", $Instances{'test_3'} ? 'zomby' : 'died';

# Test 4 - first FAIL
# $test_4 - is zomby
{
    my $test_4 = new ZombyTest( 'test_4' );

    my $sub_1 = sub {
        my $sub_2 = sub {
            print $test_4;
        };
    };
};

warn "test_4 is ", $Instances{'test_4'} ? 'zomby' : 'died';

# Test 5 - another mysterious FAIL
# $test_5_2 - is zomby
# $test_5_1 - is zomby too ( only under v5.6.*)
{
    my $test_5_1 = new ZombyTest( 'test_5_1' );
    my $test_5_2 = new ZombyTest( 'test_5_2' );

    my $sub_1 = sub {
        print $test_5_1;
        my $sub_2 = sub {
            print $test_5_2;
        };
    };
};

warn "test_5_1 is ", $Instances{'test_5_1'} ? 'zomby' : 'died';
warn "test_5_2 is ", $Instances{'test_5_2'} ? 'zomby' : 'died';


P.S. I have also check this bug under v5.6.1 & v5.8.8


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.8.4:

Configured by ActiveState at Tue Jun  1 11:52:09 2004.

Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DNO_HASH_SEED
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8,
Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
-libpath:"D:\\WWW\\perl\\lib\\CORE"  -machine:x86'
    libpth=C:\\PROGRA~1\\MICROS~3\\VC98\\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib
odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib
version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -libpath:"D:\\WWW\\perl\\lib\\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    22751 Update to Test.pm 1.25
    21540 Fix backward-compatibility issues in if.pm

---
@INC for perl v5.8.4:
    D:/Work/Soft/perl-5.8.4/lib
    D:/Work/Soft/perl-5.8.4/site/lib
    .

---
Environment for perl v5.8.4:
    HOME (unset)
    LANG=RU
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=D:\\Work\\Soft\\perl-5.8.4\\bin\\;D:\\Work\\Soft\\ruby-1.8.6\\bin;C:\\Program
Files\\ActiveState Komodo IDE
4.1\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program
Files\\ATI Technologies\\ATI.ACE\\Core-Static;D:\\Work\\WWW\\php-5.2.0\\;C:\\Program
Files\\OpenVPN\\bin
    PERL_BADLANG (unset)
    SHELL (unset)


