I would prefer to write
(ref $obj)->new
instead of
$obj->new
because that tells the reader that the type of $obj
is variable or questionable. If I write
Obj->new
there is no doubt of the type. There is less chance
the reader will research the wrong package if he wants
to do something with the created object.
If I just write $obj->new as a convenient
shorthand I hide this info. Thus
I make the code more complicated to understand.
In reply to (Re:) $class = ref $class || $class
by rir
in thread Constructor/Factory Orthodoxy
by mojotoad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |