plugins, hooks and subclassing

Oliver Gorwits oliver.gorwits at
Fri Oct 5 08:54:28 PDT 2007

Hi, mongers,

I've had a request from a user of one of my modules:

"Have you considered adding init, pre- and post-request hooks to
RPC::Serialized::Server? I'm subclassing it to include a stateful agent
and, while it's easy just to over-ride new, I think hooks would be cleaner"

Well, I'm not so sure about that myself. For a module which is OO with
no functional interface, as the author I'd prefer not to have to touch
lots of the code to add hooks. This is something OO naturally serves
well, to my mind.

Admittedly the methods in each class are not fully documented, so the
user may have had to read the source to work out which methods they want
to override. Perhaps fixing the documentation and adding an "extending
the functionality" section is the answer.

What opinions on plugins/hooks/subclassing are out there? I'm happy to
be enlightened on the subject. If hook or plugin support is recommended
- which modules/idioms are preferred?

Oliver Gorwits, Network and Telecommunications Group,
Oxford University Computing Services

More information about the MiltonKeynes-pm mailing list