in reply to Blessing into the same package in class (object) and tie contexts

Why use (ref($_[0]) || $_[0]) in one place and __PACKAGE__ in the other?
sub new { my $class = (ref($_[0]) || $_[0]); my $self = bless {}, $class; tie %$self, $class; $self }

Replies are listed 'Best First'.
Re^2: Blessing into the same package in class (object) and tie contexts
by ryangies (Initiate) on Mar 27, 2008 at 18:42 UTC
    Oops, thank you, I updated the post.