[prog] Perl module design

Dan Richter daniel.richter at wimba.com
Fri Jun 13 11:56:01 EST 2003


I would like to write a Perl module that uses the HTML::Parser class as a 
backend but provides different functionality. The HTML::Parser class 
requires callback functions, either passed as a parameter or in the form of 
overridden methods in a subclass.

For me the ideal situation is to have several classes (that do several 
different things), each of which inherit from HTML::Parser and each of 
which are used as backends, with the main class used as a frontend. But if 
I do this, do I have to make separate modules for each class? The classes 
don't have to be visible to the user, but they do have to be visible to the 
HTML::Parser class from which they inherit (don't they)? It would be better 
if I could avoid making separate modules for each sub-class, just because 
that's extra modules to install.

The other solution that I see is providing callbacks in the frontend 
namespace/class, which is obviously less than ideal.

Are there any other possibilities that I've overlooked?

========== Dan Richter ============== mailto:Dan at wimba.com ===========
     I'm too young to retire and too old to go back to work.
       - Barry Goldwater, explaining his U.S. presidential candidacy



More information about the Programming mailing list