Well, I'll at least submit a Test::More that should eventually pass:
#!perl use Test::More no_plan; use strict; BEGIN { require_ok('Tie::Hash') } my @RECORDER; BEGIN { package Tie::Test; use base 'Tie::StdHash'; sub FETCH { my $self = shift; push @RECORDER, [$self, 'FETCH', @_]; $self->SUPER::FETCH(@_); } sub STORE { my $self = shift; push @RECORDER, [$self, 'STORE', @_]; $self->SUPER::STORE(@_); } } tie my %tiedhash, Tie::Test::; ## direct assignments properly call STORE @RECORDER = (); $tiedhash{flintstone} = 'fred'; is_deeply(\@RECORDER, [[tied %tiedhash, 'STORE', 'flintstone', 'fred'] +]); ## however, this autoviv *should* first call FETCH to notice ## that $tiedhash{rubble} is undef, then call STORE to ## try to put a new anon hash into the slot (it doesn't), then ## call FETCH to fetch this new anon hash (it doesn't), which ## is then used to plug barney with short. ## ## instead, it calls FETCH to notice that $tiedhash{rubble} is undef, ## and then STORE with a newly populated hashref that already has ## { barney => 'short' }. I say this is a bug! @RECORDER = (); $tiedhash{rubble}{barney} = 'short'; is($_, tied %tiedhash, 'action is against %tiedhash') for map $_->[0], @RECORDER; is($RECORDER[0][1], 'FETCH', 'first op is a fetch') and is($RECORDER[0][2], 'rubble', 'fetching key of rubble') and is($RECORDER[1][1], 'STORE', 'second op is a store') and is($RECORDER[1][2], 'rubble', 'storing key of rubble') and isa_ok($RECORDER[1][3], 'HASH', 'storing an anonhash') and is(keys %{$RECORDER[1][3]}, 0, 'empty anonhash') and is($RECORDER[2][1], 'FETCH', 'third op is a fetch') and is($RECORDER[2][2], 'rubble', 'fetching key of rubble') and is(@RECORDER, 3, 'only 3 steps'); use Data::Dumper; diag(Dumper [\@RECORDER]);

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


In reply to Re^8: DBM::Deep Problem by merlyn
in thread DBM::Deep Problem by travisbickle34

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.