On Feb 20, 2004, at 11:29 PM, R. Joseph Newton wrote:

Jacob Chapa wrote:

what does bless do?

It gives the hash reference offered as the first argument access to the methods
of the package named by the second argument. there is more, but this is an
alright place to start.


The effect is to turn the hash reference into an object reference. Ideally,
class users should not ever have to access the hash elements directly, and
should instead use these class methods to query or modify attributes of the
object, or to carry out its functions.

The above is a lot more accurate if you remove all occurrences of the word "hash".


A hash reference is the most common thing bless()ed I'll grant you, but it is by no means the only choice and certainly not the right choice in every case.

The first argument to bless() is a reference, not a hash reference.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to