Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 cooling their heels in the Monastery: (7)
As of 2015-07-05 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls