in reply to Re: A few Perl OOP questions.
in thread A few Perl OOP questions.

$self is make to be an instance of the first parent class having a new() class method. It$self will likely soon be re-blessed into $class, perhaps with some additional initialization.

I don't think this is correct. Try the following:

package Foo; sub new { my $class = shift; print "In Foo with '$class'\n"; return bless {}, $class; } package Bar; @ISA = qw(Foo); sub new { my $class = shift; my $self = $class->SUPER::new; print "In Bar with a self of '$self'\n"; return $self; }

Now, I'm assuming that all classes in this hierarchy are using the two-arg form of bless. If they are, then $class will be passed around and it will be the child class.

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

... strings and arrays will suffice. As they are easily available as native data types in any sane language, ... - blokhead, speaking on evolutionary algorithms

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Re: A few Perl OOP questions.
by Zaxo (Archbishop) on Oct 20, 2003 at 22:40 UTC

    You're right. The delegated call still gets the child's class name as its first argument. Further initialization remains likely.

    After Compline,
    Zaxo