in reply to OO Perl: calling a constructor within a class
The only thing special about a constructor is that it
blesses a var. The name 'new' is picked by convention. So no
hidden language tricks here.
Jeroen
"We are not alone"(FZ)
Just call them at will, make sure you only bless once. Add a check like:
Hope this helps,sub new { my $me = shift; if (ref( $me ) eq 'my_class_name') { print "I'm blessed!\n"; } else { ......
Jeroen
"We are not alone"(FZ)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: OO Perl: calling a constructor within a class
by davorg (Chancellor) on Sep 26, 2001 at 14:24 UTC | |
by gbarr (Monk) on Sep 26, 2001 at 20:49 UTC | |
by runrig (Abbot) on Sep 26, 2001 at 22:35 UTC | |
by tye (Sage) on Sep 27, 2001 at 21:32 UTC | |
by jeroenes (Priest) on Sep 27, 2001 at 09:52 UTC | |
by dragonchild (Archbishop) on Sep 27, 2001 at 17:39 UTC | |
by tilly (Archbishop) on Sep 27, 2001 at 21:05 UTC |
In Section
Seekers of Perl Wisdom