in reply to Re: A Class inside a Perl script?
in thread A Class inside a Perl script?
my $class = ref $proto || $proto; ... bless $self, $class;
Don't do that. It generates a function/method that implies both constructor and clone semantics. new should be a class function that generates a new initialised object. An explicit copy or clone method (not class function) should be used to generate a cloned instance of an existing object. new() function: incorrect? and its replies discuss the topic at some length.
|
---|