develooper Front page | perl.perl5.porters | Postings from November 2005

[perl #37776] "my $var = undef" fails to set $var when re-run

Thread Next
From:
Erland Sommarskog
Date:
November 28, 2005 14:35
Subject:
[perl #37776] "my $var = undef" fails to set $var when re-run
Message ID:
rt-3.0.11-37776-124937.2.13281857364144@perl.org
# New Ticket Created by  Erland Sommarskog 
# Please include the string:  [perl #37776]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37776 >


This is a bug report for perl from esquel@sommarskog.se,
generated with the help of perlbug 1.34 running under perl v5.8.3.


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

This script:

   use strict;

   my $go = 3;
   rest_of_line:

   my $test = undef;
   print '$test is ' . (defined $test ? "'$test'" : 'undef') . "\n";
   $test = 'sockerskål';
   $go--;
   goto rest_of_line if $go;

prints:

   $test is undef
   $test is 'sockerskål'
   $test is 'sockerskål'

in Perl 5.8.7 and Perl 5.9.2. In 5.8.3 and 5.6.1 it prints "$test is undef" thrice.
A workaround is put a block around the loop. (One could even claim that it is
good practice.)




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

Configured by ActiveState at Tue Feb  3 00:28:38 2004.

Summary of my perl5 (revision 5 version 8 subversion 3) 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:"F:\Perl\AS-809\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:"F:\Perl\AS-809\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    22218 Remove the caveat about detached threads crashing on Windows
    22201 Avoid threads+win32 crash by freeing Perl interpreter slightly later
    22169 Display 'out of memeory' errors using low-level I/O
    22159 Upgrade to Time::Hires 1.55
    22120 Make 'Configure -Dcf_by=...' work
    22051 Upgrade to Time::HiRes 1.54
    21540 Fix backward-compatibility issues in if.pm

---
@INC for perl v5.8.3:
    F:/utveckling/AbaPerls/Perl
    F:/Perl/AS-809/lib
    F:/Perl/AS-809/site/lib
    .

---
Environment for perl v5.8.3:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=F:\Perl\AS-809\bin;F:\Utveckling\VS.dotnet\Common7\IDE;F:\Utveckling\VS.dotnet\VC7\BIN;F:\Utveckling\VS.dotnet\Common7\Tools;F:\Utveckling\VS.dotnet\Common7\Tools\bin\prerelease;F:\Utveckling\VS.dotnet\Common7\Tools\bin;F:\Utveckling\VS.dotnet\FrameworkSDK\bin;E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705;F:\utveckling\abaperls\perl;F:\Utveckling\Diverse;F:\Perl\AS-631\bin;E:\Program Files\Microsoft SQL Server\80\Tools\BINN;E:\Program Files\TextPad 4;E:\Program Files\Beyond Compare\1.9f;E:\Program Files\Support Tools\;E:\WINDOWS\system32;E:\WINDOWS;E:\WINDOWS\system32\WBEM;F:\Internet\Telnet\Secure CRT4;F:\Internet\SecureFX;E:\Program Files\Executive Software\Diskeeper\;E:\Program Files\IrfanView;E:\Program Files\Microsoft SQL Server\80\Tools\Binn\;E:\Program Files\Microsoft SQL Server\90\DTS\Binn\;E:\Program Files\Microsoft SQL Server\90\Tools\binn\;E:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;
    PERLLIB=F:/utveckling/AbaPerls/Perl
    PERL_BADLANG (unset)
    SHELL (unset)


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