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

[ID 20001110.003] lvalue sub returning nonexistant hash value

From:
sthoenna
Date:
November 10, 2000 14:06
Subject:
[ID 20001110.003] lvalue sub returning nonexistant hash value
Message ID:
200011102205.eAAM5V505390@garcia.efn.org
This is a bug report for perl from sthoenna@efn.org,
generated with the help of perlbug 1.33 running under perl v5.7.0.


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

Doesn't work:

[D:\perl-current].\perl -wIlib
sub set:lvalue { $_[0]->{$_[1]} }
$x = bless {};
$x->set('foo') = 'bar';
__END__
Can't return a readonly value from lvalue subroutine at - line 3.

Have to say:

sub set:lvalue { exists $_[0]->{$_[1]} ?
                        $_[0]->{$_[1]} :
                       ($_[0]->{$_[1]} = undef) }

Surely the hash element could autovivify in lvalue context?

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

Configured by sthoenna at Wed Nov  8 16:15:30 PST 2000.

Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
  Platform:
    osname=os2, osvers=2.30, archname=os2-64int-ld
    uname='os2 efn.org 2 2.30 i386  '
    config_args='-de -Dprefix=d:/perl -Dusedevel -Duse64bitint -Duselongdouble -Aoptimize=-DDEBUGGING'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=define
  Compiler:
    cc='gcc', ccflags ='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -D_EMX_CRT_REV_=63',
    optimize='-O2 -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -s -DDEBUGGING',
    cppflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -D_EMX_CRT_REV_=63'
    ccversion='', gccversion='2.8.1', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags ='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000'
    libpth=d:/emx/lib d:/emx/lib/mt
    libs=-lsocket -lm -lbsd
    perllibs=-lsocket -lm -lbsd
    libc=d:/emx/lib/mt/c_import.lib, so=dll, useshrplib=true, libperl=libperl.lib
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-Zdll', lddlflags='-Zdll -Zomf -Zmt -Zcrtdll -s'

Locally applied patches:
    DEVEL7612

---
@INC for perl v5.7.0:
    lib
    d:/perl/lib/5.7.0/os2-64int-ld
    d:/perl/lib/5.7.0
    d:/perl/lib/site_perl/5.7.0/os2-64int-ld
    d:/perl/lib/site_perl/5.7.0
    d:/perl/lib/site_perl
    .

---
Environment for perl v5.7.0:
    HOME=d:\home\sthoenna
    LANG=en_us
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR=sthoenna
    PATH=d:\bin;C:\OS2;d:\perl\bin;C:\OS2\SYSTEM;C:\OS2\INSTALL;C:\;C:\OS2\MDOS;C:\OS2\APPS;C:\MMOS2;d:\os2apps\util;d:\DOSAPPS\UTIL;c:\sio;D:\WINDOWS;d:\pdksh;d:\emx\bin;d:\emacs\19.33\bin;d:\ispell
    PERL_BADLANG (unset)
    PERL_RUN=perl
    PERL_SH_DIR=d:\BIN
    SHELL (unset)




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About