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

[ID 20001223.002] lvalues in list context

Thread Next
From:
root
Date:
December 23, 2000 10:10
Subject:
[ID 20001223.002] lvalues in list context
Message ID:
200012231959.eBNJxs600777@dgreaves.com

This is a bug report for perl from david@dgreaves.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]
The behaviour I get using lvalues in a list is unexpected.

The output I get is:
% perl try.pl
1 aaa2 bbb3 ccc4 ddd5 eee
1 aaa bbb ccc ddd eee fff ggg hhh2 3 4 5 
1 aaa2 bbb3 ccc4 ddd5 eee

Here's a small test script...

package lv;
sub new {
    my $class = shift;
    my $self = {_attr1 => undef,
		_attr2 => undef,
		_attr3 => undef,
		_attr4 => undef,
		_attr5 => undef,
	    };
    bless $self, $class;
}

sub attr1 : lvalue { $_[0]->{_attr1}; }
sub attr2 : lvalue { $_[0]->{_attr2}; }
sub attr3 : lvalue { $_[0]->{_attr3}; }
sub attr4 : lvalue { $_[0]->{_attr4}; }
sub attr5 : lvalue { $_[0]->{_attr5}; }


package main;

my $line = "aaa bbb ccc ddd eee fff ggg hhh";

my $lvo = lv->new;
my ($a1, $a2, $a3, $a4, $a5);

($a1, $a2, $a3, $a4, $a5) = split ' ', $line;

print "1 ",$a1,
    "2 ",$a2,
    "3 ",$a3,
    "4 ",$a4,
    "5 ",$a5,
    "\n";

($lvo->attr1, $lvo->attr2, $lvo->attr3, $lvo->attr4, $lvo->attr5) = split ' ', $line;

print "1 ",$lvo->attr1,
    "2 ",$lvo->attr2,
    "3 ",$lvo->attr3,
    "4 ",$lvo->attr4,
    "5 ",$lvo->attr5,
    "\n";

($lvo->attr1, $lvo->attr2, $lvo->attr3, $lvo->attr4, $lvo->attr5) = ($a1, $a2, $a3, $a4, $a5);

print "1 ",$lvo->attr1,
    "2 ",$lvo->attr2,
    "3 ",$lvo->attr3,
    "4 ",$lvo->attr4,
    "5 ",$lvo->attr5,
    "\n";



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

Configured by prospector at Mon Aug  7 10:58:30 EDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.5-22smp, archname=i386-linux
    uname='linux porky.devel.redhat.com 2.2.5-22smp #1 smp wed jun 2 09:11:51 edt 1999 i686 unknown '
    config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Uuselargefiles'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=undef 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O2 -march=i386 -mcpu=i686', gccversion=2.96 20000731 (experimental)
    cppflags='-fno-strict-aliasing'
    ccflags ='-fno-strict-aliasing'
    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
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc-2.1.92.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:
    

---
@INC for perl v5.6.0:
    /usr/lib/perl5/5.6.0/i386-linux
    /usr/lib/perl5/5.6.0
    /usr/lib/perl5/site_perl/5.6.0/i386-linux
    /usr/lib/perl5/site_perl/5.6.0
    /usr/lib/perl5/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/root
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
    PERLDOC_PAGE=less -+C -E
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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