in reply to Re^4: need help with Tie::Judy
in thread need help with Tie::Judy

> Is that something like correct?

more or less, yes.

The tie() function binds a variable to a class (package) that will provide the implementation for access methods for that variable. Once this magic has been performed, accessing a tied variable automatically triggers method calls in the proper class. The complexity of the class is hidden behind magic methods calls.

see also perltie#Tying-Hashes

> I deliberately didn't refer to %fruit_color here as a hash

No it's for sure a "tied hash" in this case implementing a "hash". Both is correct.

Perl's generic term for associative arrays is "hash", no matter which implementation is used, so this is still a hash.

But a "tied hash" actually only refers to the %syntax and connected hash operators.

A tied hash may be used for any kind of magic, like e.g.

But - besides providing a different implementations for hashes - it's in my experience mostly only used for syntactic sugar.

Most authors prefer providing an explicit OOP solution (like $time->get("London") ) and avoid the magic.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery