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

[ID 20010806.008] tied hashes, invocation of FIRSTKEY

Thread Next
From:
goevert
Date:
August 6, 2001 05:31
Subject:
[ID 20010806.008] tied hashes, invocation of FIRSTKEY
Message ID:
yexelqpgymq.fsf@charlie.cs.uni-dortmund.de
This is a bug report for perl from goevert@ls6.cs.uni-dortmund.de,
generated with the help of perlbug 1.33 running under perl v5.6.1.


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

In the code below I would expect that the FIRSTKEY method is called
twice (once in every loop iteration). But it's only called once:

Output:

  [goevert@emsland] ~/tmp/perl.pl
  FIRSTKEY called
  
Code:

  #!/usr/sw/perl/default/bin/perl -w
  
  use strict;
  
  my($key, $value);
  
  foreach (0 .. 1) {
    my %h;
    tie %h, 'MyTiedHash';
    $h{foo} = 'bar';
    ($key, $value) = each %h;
  }
  
  package MyTiedHash;
  
  use Tie::Hash;
  use base qw(Tie::StdHash);
  
  sub FIRSTKEY {
    print STDERR "FIRSTKEY called\n";
    my $self = shift;
    $self->SUPER::FIRSTKEY(@_)
  }
  

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

Configured by goevert at Thu Jul  5 17:09:15 CEST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.2.19, archname=i686-linux
    uname='linux schulz 2.2.19 #1 fri may 11 10:50:23 mest 2001 i686 unknown '
    config_args='-der -Dcc=gcc -Doptimize=-O3 -Dloclibpth=/usr/sw/wais/default/lib /usr/sw/xml/default/lib -Dlocincpth=/usr/sw/wais/default/lib /usr/sw/xml/default/include -Dprefix=/usr/sw/perl/5.6.1 -Darchlib=/usr/sw/perl/5.6.1/lib -Dprivlib=/usr/sw/perl/5.6.1/lib -Dsitelib=/usr/sw/perl/5.6.1/lib/site_perl -Dsitearch=/usr/sw/perl/5.6.1/lib/site_perl -Dmydomain=.cs.uni-dortmund.de -Dcf_email=goevert@ls6.cs.uni-dortmund.de -Dperladmin=goevert@ls6.cs.uni-dortmund.de -Ubincompat5005'
    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=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/sw/wais/default/lib -I/usr/sw/xml/default/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3',
    cppflags='-fno-strict-aliasing -I/usr/sw/wais/default/lib -I/usr/sw/xml/default/include'
    ccversion='', gccversion='2.95.2 20000220 (Debian GNU/Linux)', 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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/sw/wais/default/lib -L/usr/sw/xml/default/lib -L/usr/lib -L/usr/X11R6/lib'
    libpth=/usr/sw/wais/default/lib /usr/sw/xml/default/lib /lib /usr/lib /usr/local/lib
    libs=-lnsl -lndbm -lgdbm -ldbm -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/sw/wais/default/lib -L/usr/sw/xml/default/lib -L/usr/lib -L/usr/X11R6/lib'

Locally applied patches:
    

---
@INC for perl v5.6.1:
    /usr/sw/pilot/null.0/lib/site_perl
    /usr/sw/perl/5.6.1/lib
    /usr/sw/perl/5.6.1/lib/site_perl
    /usr/sw/perl/5.6.1/lib/site_perl
    /usr/sw/perl/5.6.1/lib/site_perl
    .

---
Environment for perl v5.6.1:
    HOME=/home/goevert
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/sw/perl/5.6.1/bin:/usr/sw/emacs/21.0.104/bin:/usr/sw/xtea/1.3/bin:/usr/sw/xpostit/3.3.2/bin:/usr/sw/xml/null.0/bin:/usr/sw/xdu/3.0/bin:/usr/sw/wais/2.2.14/bin:/usr/sw/sgml/default/bin:/usr/sw/postgresql/7.1.2/bin:/usr/sw/plan/1.8.4/bin:/usr/sw/pilot/null.0/bin:/usr/sw/mysql/3.23.39-max/bin:/usr/sw/java/jdk1.3.1/bin:/usr/sw/ica/6.0.908:/usr/sw/hyspirit/2.5.0/bin:/usr/sw/finger/1.37/bin:/usr/sw/daffodil/1/bin:/usr/sw/ctwm/3.5.2c/bin:/usr/sw/ant/jakarta-ant-1.3/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/usr/games:/sbin:/usr/sbin:/home/goevert/bin:.
    PERLLIB=/usr/sw/pilot/null.0/lib/site_perl:
    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