[1071] in BarnOwl Developers
Re: Rethinking ::Hook
daemon@ATHENA.MIT.EDU (Geoffrey G Thomas)
Thu Oct 29 18:12:43 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
Date: Sun, 18 May 2008 04:45:50 -0400 (EDT)
From: Geoffrey G Thomas <geofft@MIT.EDU>
To: Nelson Elhage <nelhage@mit.edu>
cc: barnowl-dev@mit.edu
In-Reply-To: <20080517193559.GP8761@mit.edu>
On Sat, 17 May 2008, Nelson Elhage wrote:
> 1. Have modules register a function name as a string, rather than a
> subref. This has the property (not always good) that if the code
> changes but the hook doesn't get re-registered, the new hook takes
> effect.
>
> 2. Use Sub::Identify or similar to ask perl what function the
> subroutine represents, and filter the hook list to remove any other
> function of that name.
>
> 3. Use caller() to figure out which module is registering this hook,
> and only de-register hooks for a specific module before reloading
> that module
>
> 4. Have modules provide a string "name" or identifier for each hook
> they register, and remove handlers sharing the same name.
I don't understand Perl OO too well, but is there something like an
abstract class method that we can ask modules to implement if they wish to
add a hook? This avoids any outside dependencies on the naming scheme of
internal functions, and potentially of modules as well....
--
Geoffrey Thomas
geofft@mit.edu