[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
[ID 20000123.003] [BUG our() 5.005_63] Lexical scoping problems.
I've bumped into a few basic scoping problems with our():
our $a = "Outer";
{
our $a = "Inner";
print "$a\n";
}
print "$a\n";
$a is "Inner" in both places. If I understand how our() works, its
supposed to have the same scoping rules as my(). I would expect
"Inner" and then "Outer", same as my().
Next, our() doesn't appear to localize in a loop conditional:
our $a = "Outer";
for (our $a = 1; $a < 2; $a++) {
print "$a\n";
}
print "$a\n";
$a is 3, not "Outer" after the for loop. I presume the two bugs are
related.
However, this -does- work as expected.
our $a = "Outer";
for our $a (1, 2) {
print "$a\n";
}
print "$a\n";
$a is 'Outer' after the for loop.
Summary of my perl5 (revision 5.0 version 5 subversion 63) configuration:
Platform:
osname=linux, osvers=2.2.10, archname=i686-linux
uname='linux athens 2.2.10 #3 smp mon aug 2 16:48:09 edt 1999 i686 unknown '
config_args=''
hint=previous, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
use64bits=undef usemultiplicity=undef
Compiler:
cc='cc', optimize='-g', gccversion=2.95.2 19991109 (Debian GNU/Linux)
cppflags='-Dbool=char -DHAS_BOOL -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -DDEBUGGING_OPS -DDEBUGGING_MSTATS'
ccflags ='-Dbool=char -DHAS_BOOL -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -DDEBUGGING_OPS -DDEBUGGING_MSTATS'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
alignbytes=4, usemymalloc=y, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=/lib/libc-2.1.2.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under linux
Compiled at Jan 3 2000 05:17:35
@INC:
/usr/local/perl5.005_63/lib/i686-linux
/usr/local/perl5.005_63/lib
/usr/local/perl5.005_63/lib/site_perl/i686-linux
/usr/local/perl5.005_63/lib/site_perl
.
--
Michael G Schwern schwern@pobox.com
http://www.pobox.com/~schwern
/(?:(?:(1)[.-]?)?\(?(\d{3})\)?[.-]?)?(\d{3})[.-]?(\d{4})(x\d+)?/i
- Follow-Ups from:
-
Gurusamy Sarathy <gsar@ActiveState.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]