in reply to Life in the land of OOP, and I'm confused.

The author of HTML::TableExtract apparently did not make the interface "pluggable", allowing you to optimize behavior on not only the class you're inheriting, but on classes it also creates and uses.

This is typical, in my observation. Unless a class is designed very very very carefully, it's generally not cleanly subclassable for all needs.

For this particular case, you'll probably have to override any method that refers by name to HTML::TableExtract::TableState to create a new class of your choosing. And yes, that'll require cutting and pasting code for the parts that didn't change. Sucks, doesn't it?

What's missing is a method like:

sub createTableState { my $self = shift; return HTML::TableExtract::TableState->new(@_); } sub initialize_some_stuff { my $self = shift; blah blah; $self->{state} = $self->createTableState; blah blah; }
Then you could override just the thing that makes the child object to make one of your object. Write the author and maybe they'll put that in.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
(jcwren) RE: Re: Life in the land of OOP
by jcwren (Prior) on Aug 03, 2000 at 07:24 UTC
    Using the crasser method of simply providing a HTML::TableExtract::TableState::_add_text() method, how would I go about accessing the data of the jcwExtract class?

    I can figure out to access the parent class data (HTML::TableExtract), but not it's parent (jcwExtract). Any thoughts?

    --Chris

    e-mail jcwren