If you've ever worked with Perl's
various Tie::* base classes, the idea is similar:
you start out with a base class with callbacks defined that
don't do anything very exciting, but by their
existence satisfy all the subroutine calls triggered by SAX events.
In your own driver class, you simply redefine the subroutines that
should do something special and let the default behavior rule for all
the events you don't care much about.
The default behavior, in this case, gives you something nice, too:
access to an array of strings (stored as an instance variable on the
handler object) holding the XML document that the incoming SAX events
built. This isn't necessarily very interesting if
your data source was XML, but if you use a PerlSAXish driver to
generate an event stream out of an unsuspecting data source, then
this feature is lovely. It gives you an easy way to, for instance,
convert a non-XML file into its XML equivalent and save it to disk.
The trade-off is that you must remember to invoke
$self->SUPER::[methodname] with all your own
event handler methods. Otherwise, your class may forget its roots and
fail to add things to that internal strings array in its youthful
naïveté, and thus leave embarrassing holes in
the generated XML document.
 |  |  |
5.5. A Handler Base Class |  | 5.7. XML::SAX: The Second Generation |