bugsbunny has asked for the wisdom of the Perl Monks concerning the following question:
The shortened code is below..$hash{keylvl1}{keylvl2}
When I do this several assignments I get FETCHE's instead of STORE:package Tie::HashDF; use strict; BEGIN { require Exporter; require Tie::Hash; @Tie::HashDF::ISA = qw(Exporter Tie::StdHash); @Tie::HashDF::EXPORT = qw(); } sub tolog { print "$_[0] : $_[1]\n"} sub TIEHASH { my $self = bless {}, shift; return $self } sub FETCH { tolog 'FETCH', "$_[1] : $_[0]{$_[1]}"; $_[0]{$_[1]} } sub STORE { tolog 'STORE'; } 1;
-----#!/usr/bin/perl use strict; use lib '/work/lib'; use Tie::HashDF; my $obj = tie my %hash, 'Tie::HashDF'; #my $a = $hash{toby}{ip}; $hash{toby}{ip} = '111'; $hash{drago}{account} = 'halo'; #undef $obj; #untie %hash;
Could this be problem 'cause it is not onlevel-hash.. When I write this hash to disk all changes I have made are seen. i.e. it works as expected from me, but instead of triggering STORE it triggers FETCH..FETCH : toby : HASH(0x821a9a0) FETCH : drago : HASH(0x81433fc)
what I'm doing wrong ?FETCH : toby : HASH(0x821a9dc) FETCH : toby : HASH(0x821a9dc) FETCH : drago : HASH(0x8143520)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: tieing HoH
by BrowserUk (Patriarch) on Jan 14, 2004 at 13:51 UTC | |
by bugsbunny (Scribe) on Jan 14, 2004 at 15:14 UTC | |
|
Re: tieing HoH
by Abigail-II (Bishop) on Jan 14, 2004 at 13:49 UTC | |
|
Re: tieing HoH
by artist (Parson) on Jan 14, 2004 at 18:45 UTC | |
|
Re: tieing HoH
by flyingmoose (Priest) on Jan 14, 2004 at 17:11 UTC | |
|
Re: tieing HoH
by delirium (Chaplain) on Jan 15, 2004 at 12:47 UTC |