($copyto, $fail) = dbme ($newcopy, 1); $copyto->{$k} = $copyfrom->{$k}; # #... succeeds ... # #cleanup if (tied $copyto) { untie (%$copyto); print "CLEANUP: Tied-HASH now untied\n"; } else { print "'tied()'-test on copyto FAILED\n"; if (ref($copyto) eq 'HASH') {print "copyto= $copyto\n";} eval {untie (%$copyto);}; if ($@) {print "UNTIE copyto FAILED --> $@\n";} else { print "UNTIE copyto succeeded ......\n"; } } # # OUTPUT: # .. 'tied()'-test on copyto FAILED ...... # .. copyto= HASH-REF --> HASH(0x8e02f5c) # HANGS on "eval {untie (%$copyto);};" line # NEVER RETURNS ? #

EXPLANATION:

dbme() line-1 is in another module, gets a reference to a tied-hash handle on a Berkeley DB file from yet another module, returns it to this code, and which then succeeds. The record copied line-2 appears in the underlying file. But the 'untie' needed to then close the file hangs .. I have to CTRL-C to quit?

Can anyone see what I am getting wrong?


In reply to untie tied hash fails mysteriously by Pstack

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.