Yes, but doing so is naughty.

On Thu, Sep 9, 2010 at 11:43 AM, David Nicol <davidni...@gmail.com> wrote:

> one surprising aspect of perl is that C<bless> affects the object, not
> the reference, so it is possible to rebless things, which is handy if
> you use package-based state machines
>
> D:\>perl -le "bless $o=[],'abc';print $o; sub f{$l=shift; bless
> $l,'DEF'} f $o; print $o"
> abc=ARRAY(0x3e5444)
> DEF=ARRAY(0x3e5444)
>
> because after C< my $self = shift > you can bless $self and the
> invocant will get reblessed.
>
> So whenever anyone says "a Perl object is a blessed reference" they're
> speaking procedurally, not descriptively. Descriptively, a Perl object
> is a reference to a blessed thingy.
>
> (I think that's correct terminology, please correct if wrong)
>



-- 
Check out my LEGO blog at http://www.brickpile.com/
View my photos at http://flickr.com/photos/billward/
Follow me at http://twitter.com/williamward

Reply via email to