http://qs321.pair.com?node_id=354008


in reply to Confused by OO & tie

However I had a feeling that tie had something to do with OO

You can disregard 'tie' as you learn OO. tie can be used to bind variables to objects so that in-memory variables (hashes for instance) actually do something else behind the scenes. An example might be a hash that really saved everything you wrote to a database, or maybe a hash that relayed all lookups to a remote server.

How's this work? Well, there is an object behind the scenes that masquerades as the hash... kinda sorta...

Anyhow, knowledge of tie is not required for any OO implementation, only if you want to, say, make a hash that has special magic behind the scenes. If you are just using a blessed hash reference to hold your object member data, you don't have to worry about tie. In fact, I've never found a need for it ... but if you have an existing block of code that works with a regular hash, the exact same code will work on a tied hash, and that makes tie interesting.

Also see "perldoc perltie" rather than "perldoc -f tie", as that seems to make a ton of more sense.