in reply to Re: OO Perl: calling a constructor within a class
in thread OO Perl: calling a constructor within a class
Using code like ref($me) eq 'my_class_name' can break inheritance if $me doesn't contain an object of your class, but rather an object of a class that inherits from your class. Far better to use the isa method (from the UNIVERSAL class).
--if (ref($me} && $me->isa('my_class_name')) {
<http://www.dave.org.uk>
"The first rule of Perl club is you don't talk about Perl club."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: OO Perl: calling a constructor within a class
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 | |
Reblessing (was: OO Perl: calling a constructor within a class)
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