Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Unblessed Reference Message

by converter (Priest)
on Jan 26, 2003 at 21:36 UTC ( [id://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.

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://230051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-25 04:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found