in reply to Inheritance confusion

I think if you look at the code for Net::FTP, you'll find your answer, as Net::FTP inherits from IO::Socket::INET. As another poster mentioned, you're implementing your subclass as a hash, whereas Net::FTP is implemented as a typeglob. That's what's causing the problem. One of the weaknesses of Perl's OO implementation is that you have to know a class's internal representation in order to inherit from it.

Anyway, look in the code for Net::FTP and see how its constructor works, and implement yours the same way.

Replies are listed 'Best First'.
Re^2: Inheritance confusion
by revdiablo (Prior) on May 25, 2005 at 17:19 UTC
    One of the weaknesses of Perl's OO implementation is that you have to know a class's internal representation in order to inherit from it.

    Actually, this is not strictly true. He could use an inside-out-object-like design, and avoid using the object reference to store the data at all. He could initialize the object using the original constructor, and rebless it into his package. Voila, inheritance without knowing about the parent's internal representation. By the way, I am not saying this is the best design in these circumstances, only that it is possible.