Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://354008]
[Eily]: that's the internet for you LanX
[Eily]: and I'm pretty sure there's a rule somewhere that states that the stupider the idea, the more likely it is to already have been done
zentara is thinking of moving to Mars to esacpe it all
[LanX]: Zentara eq Dr Manhatten ?
[zentara]: more like Dr. Helion3 :-)
[LanX]: Eily: though I haven't found a a reference for this one yet : Re^2: OT: Got fired this week (orange)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2017-03-27 15:23 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.