Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local() doesn't restore variable's pos() #5344

Closed
p5pRT opened this issue Apr 21, 2002 · 2 comments
Closed

local() doesn't restore variable's pos() #5344

p5pRT opened this issue Apr 21, 2002 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 21, 2002

Migrated from rt.perl.org#8971 (status was 'resolved')

Searchable as RT8971$

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2002

From jefpin@towers.par64.org

Created by jefpin@towers.par64.org

Simply put, if you set pos($x), then local()ize $x, when you go back to
the original scope, pos($x) is undef.

  $x = "japhy";
  pos($x) = 2;
  print pos($x), "\n";
  { local $x; }
  print pos($x), "\n";
  __END__
  2

With warnings on, I'm yelled at for printing undef on line 5.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.7.3:

Configured by jefpin at Fri Apr 19 21:49:06 EDT 2002.

Summary of my perl5 (revision 5.0 version 7 subversion 3 patch 16011) configuration:
  Platform:
    osname=linux, osvers=2.2.16-3, archname=i586-linux
    uname='linux towers.par64.org 2.2.16-3 #5 sat jul 8 11:42:18 edt 2000 i586 unknown '
    config_args='-DDEBUGGING -Dusedevel -Dprefix=/home/jefpin/bleadperl -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=define
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -I/usr/include/gdbm'
    ccversion='', gccversion='egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil
    libc=/lib/libc-2.1.3.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'

Locally applied patches:
    DEVEL16004


@INC for perl v5.7.3:
    /home/jefpin/bleadperl/lib/5.7.3/i586-linux
    /home/jefpin/bleadperl/lib/5.7.3
    /home/jefpin/bleadperl/lib/site_perl/5.7.3/i586-linux
    /home/jefpin/bleadperl/lib/site_perl/5.7.3
    /home/jefpin/bleadperl/lib/site_perl
    .


Environment for perl v5.7.3:
    HOME=/home/jefpin
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin:/home/jefpin/bin:/tmp/bleadperl/bin
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh


@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2002

From @vanstyn

Jeff Pinyan <jefpin@​towers.par64.org> wrote​:
:Simply put, if you set pos($x), then local()ize $x, when you go back to
:the original scope, pos($x) is undef.
:
: $x = "japhy";
: pos($x) = 2;
: print pos($x), "\n";
: { local $x; }
: print pos($x), "\n";
: __END__

This is a known problem; please check archives for references to
locali[sz]ation of magic.

Hugo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant