Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Unblessed Reference Message

by converter (Priest)
on Jan 26, 2003 at 21:36 UTC ( #230051=note: print w/ replies, xml ) Need Help??


in reply to Re: Unblessed Reference Message
in thread Unblessed Reference Message

A ref becomes an object after being blessed, as now Perl knows who/what it is.

This is incorrect, and will eventually bite you in the rear end. From perlfunc:

bless REF,CLASSNAME bless REF This function tells the thingy referenced by REF that it is now an object in the CLASSNAME package...

It is the thing referred to, not the reference, that is blessed. This is why we can copy the reference returned by bless and still invoke methods against the reference--perl knows that the reference refers to an object of class class because it's the referent that is marked as belonging to a particular package.


Comment on Re: Re: Unblessed Reference Message
Download Code
Re: Re: Re: Unblessed Reference Message
by pg (Canon) on Jan 26, 2003 at 21:55 UTC
    Thank you for making what I said more formal, but to be honest, I mean exactly the same thing, and I didn't expect people to misunderstand it. (Or to be precise, you correctly understood what was on the screen word by word, but had the wrong expectation.)

    This is a good lesson, and I will try to make my wording more formal.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2014-07-14 06:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (255 votes), past polls