in reply to Re^2: To be, or not to be, a package? That is the question
in thread To be, or not to be, a package? That is the question
Is better written assub new { my $self = shift; bless \( my $scalar ), ref $self || $self; }
You don't normally get a blessed reference passed into new(). If you're using my $foo = Object::Foo->new, or something similar, its the name of the class (Object::Foo in my example) that's passed into new(). So, my $class = shift; is more logical.sub new { my $class = shift; bless \( my $scalar ), $class; }
|
|---|