Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: what's difference between bless and tie?

by moritz (Cardinal)
on Dec 23, 2012 at 13:32 UTC ( #1010094=note: print w/replies, xml ) Need Help??


in reply to what's difference between bless and tie?

bless allows you to calls methods on the blessed object.

tie allows you to override built-in operations on variables, namely reading from/assigning to scalars, and list and hash operations like indexing, exists, delete etc.

So in some sense, tie works on a variable and bless works on a thing that is stored in a variable.

  • Comment on Re: what's difference between bless and tie?

Replies are listed 'Best First'.
Re^2: what's difference between bless and tie?
by anaconda_wly (Scribe) on Jan 07, 2013 at 09:02 UTC
    "bless allows you to calls methods on the blessed object." , and "the blessed object" actually a data structure saying a hash and bless tells Perl how the hash can be used(methods defined in package). I still feel they're hard to distinguish in their very initial goal.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010094]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2016-12-10 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (159 votes). Check out past polls.