Am Sonntag, 1. Mai 2005 17.52 schrieb Randal L. Schwartz: > >>>>> "John" == John Doe <[EMAIL PROTECTED]> writes: > > John> my $self=$class::SUPER->new(%params); > > I think you were trying to write: > > my $self = $class->SUPER::new(%params);
aargh - yes of course... thanks for the correction! > Unless you were really looking for a variable named $class::SUPER > to find a class/instance for the call to new. :) > > Also, you don't want to rebless when you do that. The blessing is > already correct, provided the constructors are written properly. I must admit that all code I've ever written reblesses unnecessarily (while I was always thinking that it's not necessary - and meanwhile it has become (bad) habit without using brain anymore...) This was the last time, thanks :-) > See my examples at > <http://www.stonehenge.com/merlyn/UnixReview/col52.html>. I read it the second time now and realized the line my $similar = (ref $object)->new; which I think is _the_ obvious reason why in constructors my $invocant = shift; my $class = ref($invocant) || $invocant; is superfluos. greetings, joe > -- > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 > <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl > training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>