develooper Front page | perl.perl5.porters | Postings from July 2001

[ID 20010731.072] map vs array of hashes with holes

Thread Next
Ric Anderson
July 31, 2001 13:10
[ID 20010731.072] map vs array of hashes with holes
Message ID:
This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00503.

[Please enter your report here]
--begin test program--
use strict;
$port[0]->{port_mac} = 47;
$port[0]->{port} = 147;
$port[1]->{port_mac} = 48;
$port[1]->{port} = 148;
$port[3]->{port_mac} = 56;
$port[3]->{port} = 156;
print "port array = ", join(",",@port), "\n";
$mac = 1;
map {if ($_->{port_mac} eq $mac) {$port = ($_->{port})}} @port;
$port = "not found" if(!defined($port));
print "port = $port.\n";
--end test program--
If one saves the above to poo, and runs
	perl poo
one gets
  Modification of a read-only value attempted at line 11.
It appers that map() doesn't like a sparse array of hashes.  I'm
not sure if this a bug, or a restriction that isn't apparent
to me from the documentation.

[Please do not change anything below this line]

Site configuration information for perl 5.00503:

Configured by ric at Mon Aug  7 13:59:26 MST 2000.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos 5.6 generic_105181-16 sun4u sparc sunw,ultra-enterprise '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    cc='gcc -B/usr/ccs/bin/', optimize='-O', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
    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 -B/usr/ccs/bin/', ldflags ='-L/usr/local/lib -R/usr/local/lib'
    libpth=/usr/local/lib /usr/ccs/lib /usr/openwin/lib /usr/dt/lib /usr/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib -R/usr/local/lib'

Locally applied patches:

@INC for perl 5.00503:

Environment for perl 5.00503:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About