Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Tie a hash of hashes?

by ikegami (Pope)
on Feb 02, 2006 at 20:24 UTC ( #527421=note: print w/ replies, xml ) Need Help??

in reply to Tie a hash of hashes?

The problem:

You need to convert the hashes into Tie::IxHashes.

Solution 1:

You could traverse %data and convert the appropriate hashes.

Solution 2:

You could create a subclass of Tie::IxHash to override its method. When a hash reference is added to the hash, tie the referenced hash if it isn't already tied. Don't forget to untie when appropriate.

Update: Time for a break! Neither solution works, because the order is already lost by the time the hashes can be converted.

What you need to do is to override the behaviour of the hash constructor { ... } at compile time, and I don't see any simple ways of doing that. The complex ways are 1) use a source filter and 2) replace the Perl compiler by parsing the file yourself.

Comment on Re: Tie a hash of hashes?
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://527421]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2015-10-09 17:41 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (248 votes), past polls