use Scalar::Util qw( blessed ); sub new { my $class = shift; return $class->clone( @_ ) if blessed $class; # Continue on with constructor. } sub clone { my $self = shift; return $self->new( @_ ) unless blessed $self; # Continue on with cloner. }
Otherwise, I document what my methods expect and laugh at the people who don't RTFM.
In reply to Re: Objects and references
by dragonchild
in thread Objects and references
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |