[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
[ID 20000125.009] bad interaction between 'next' and raw scope levels
This is a bug report for perl from jcox@interwoven.com,
generated with the help of perlbug 1.26 running under perl 5.00502.
-----------------------------------------------------------------
[Please enter your report here]
#==============================================================
#==============================================================
#
# Both loops below should output
#
# index: 0
# index: 2
#
# But the 1st loop outputs
#
# index: 0
# index: 1
# index: 2
#
# This is wrong, since a raw scope is not loop structure
# (ie: if/while/foreach...).
#
#
# Sincerely,
# - Jon
# <jcox@interwoven.com>
#
#==============================================================
#==============================================================
print "\nThe following loops should have the same output -- but they don't!\n";
print "\n\n'next' inside an empty scope within a 'for' loop\n";
for (my $i=0; $i<3; $i++)
{
{ # new "raw" scoping level
if ($i == 1)
{
next; # executes, but does not skip
} # the print statement! Boo hoo!
}
print "index: $i\n";
}
print "\n\n'next' inside an 'if' within a 'for' loop\n";
for (my $i=0; $i<3; $i++)
{
if (1)
{ # new scope bound to the "if(1)"
if ($i == 1)
{
next; # correctly skips the print statement
}
}
print "index: $i\n";
}
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Site configuration information for perl 5.00502:
Configured by jcox at Mon Dec 7 18:01:13 PST 1998.
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos newton 5.6 generic_105181-07 sun4u sparc sunw,ultrasparc-iii-engine '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O', gccversion=2.8.1
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -R /usr/local/lib/perl5/5.00502/sun4-solaris/CORE'
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Locally applied patches:
---
@INC for perl 5.00502:
/usr/local/lib/perl5/5.00502/sun4-solaris
/usr/local/lib/perl5/5.00502
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005
.
---
Environment for perl 5.00502:
HOME=/net/stargate/d2/iw/jcox
LANG (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=.:/usr/local/microsoft/bin:/opt/SUNWspro/bin:/usr/ucb:/net/stargate/d2/iw/jcox/bin/sol:/net/stargate/d2/iw/jcox/bin:/sbin:/bin:/usr/bin:/usr/local/bin:/usr/sbin:/usr/ccs/bin:/usr/openwin/bin:/etc:/usr/etc:/usr/local/etc:/usr/local/jcoxstuff/iw-home/bin:~jcox/bin
PERL_BADLANG (unset)
SHELL=/net/stargate/d2/iw/jcox/bin/zsh
- Follow-Ups from:
-
Ronald J Kimball <rjk@linguist.dartmouth.edu>
Larry Wall <larry@wall.org>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]