in reply to Objects and references
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Objects and references
by jeanluca (Deacon) on Sep 30, 2005 at 20:09 UTC | |
by dragonchild (Archbishop) on Sep 30, 2005 at 20:31 UTC | |
by jeanluca (Deacon) on Sep 30, 2005 at 20:40 UTC | |
by dragonchild (Archbishop) on Oct 01, 2005 at 01:05 UTC |