Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Confused by OO & tie

by flyingmoose (Priest)
on May 17, 2004 at 15:51 UTC ( #354008=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Confused by OO & tie
Re: Re: Confused by OO & tie
by Scarborough (Hermit) on May 17, 2004 at 15:57 UTC
    Thanks, I expect I'll be back later to find out more about tie as I have inherited some code that does ties to a type of resource block, unless of course you can guide me to a tie tutorial or resource a little more in depth than the perldocs mentioned in my post.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-09-23 21:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (241 votes), past polls