in reply to Re: Is Perl Truly an Object Oriented Language?
in thread Is Perl Truly an Object Oriented Language?

I don't see how or why, unless ofc when you implement it wrong...

First of all I don't really see a reason to call SUPER::new unless you are passing specific arguments which you should have specified (or unless there is initialisation which would better be done in a sub called initialise (or something like that)).

Second, usually you pass arguments to the constructor as a hash reference, since this makes it easier to use and a lot easier to modify (since you don't need to know/care what arguments comes first).

Third, if you need to know the internals of the class you are inheriting from then the implementation of that class isn't that good. If it would have been designed properly then it would have methods like set_host and/or set_port. (either normal methods or via the AUTOLOAD sub)

  • Comment on Re^2: Is Perl Truly an Object Oriented Language?

Replies are listed 'Best First'.
Re^3: Is Perl Truly an Object Oriented Language?
by William G. Davis (Friar) on Dec 03, 2004 at 18:34 UTC

    You missed the point. "host" and "port" aren't the base class' data members, they're our data members. We created an object of the class we're inheriting from, then we went and messed with its internals by adding our own data members to it. See the problem?

    Here's an example (from WWW::Mechanize):

    my $self = $class->SUPER::new( %default_parms, @_ ); $self->{page_stack} = []; $self->{quiet} = 0; $self->env_proxy(); push( @{$self->requests_redirectable}, 'POST' ); return bless $self, $class;