in reply to OOP safety

Maybe one shouldnt rely on it, but I'd hope that anybody writing a subclass of one of my classes would be calling $self->SUPER::new(@_) and so at least initialize my class the way it should be, instead of just overwriting the 'new' method. Theres not much use in inheriting, if you're not using what the module provides. Of course, that doesn't stop the overwritten method killing the contents of the object, there are ways to hide them, if you're that worried about it (theres a lovely chapter in the Camel about objects :)..
I guess you either hide everything, document properly, or do it another way.. As the book says, Perl doesn't lock you out, it just hopes you're polite enough not to wander into its space. (or something similar..)

C.

Replies are listed 'Best First'.
Re2: OOP safety
by dragonchild (Archbishop) on Apr 21, 2003 at 14:03 UTC
    ++! At the very least, the base class should be setting things up for its children. Also, imho, a base class should also provision for children to add attributes without the child having to know how they're being added. Maybe, some method the child can call in either new or in some bare-block that will add an attribute and mutator or complain if it's a redefinition?

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

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

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