Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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?
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2014-12-26 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (164 votes), past polls