Without testing either of these, I suspect that you have two options: (1) iterate through the retrieved hash, inserting key/value pairs into a newly-created Hash::Case::Lower object; or (2) go behind the back of Hash::Case::Lower to both dump out the hash, and load it back in.

The former is straightforward, and probably looks something like this:

tie my(%lc_hash), 'Hash::Case::Lower'; { my $href = retrieve( ... ); while ( my ( $k, $v ) = each %$href ) { $lc_hash{$k} = $v; } }

Although, if you're going through the whole thing anyway, there's no problem in applying lc to all the values manually. Might be faster...

To go behind its back, you will want to save it directly; the only fancy footwork should be a bless when you read it back in. (This might not even be necessary — I don't know how clever Storable is, really.)

# writing it out store( \%lc_hash, ... ); # reading it in my $lc_href = retrieve( ... ); bless $lc_href, 'Hash::Case::Lower';

All the above is untested, but hopefully it will give you some ideas to play with! :)


In reply to Re: using Hash::Case and Storable together by tkil
in thread using Hash::Case and Storable together by agaffney

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.