Just thought I'd add a little something to the HEM (Hacker/Horrible/Hotchpotch Event Model). $win->Hook() now returns the previous coderef if you reassign a hook. For instance:

my $hookone = $win->Hook(0x0020, \&setcursor);
my $hooktwo = $win->Hook(0x0020, \&somethingelse);

$hookone now equals 0 (no previous reference).
$hooktwo is now a reference to &setcursor (the hook handler that was replaced by \&somethingelse).

You can't assign more than one handler to a message, since the message identifies the handler to call on a key/value basis (just a perl list).

The function still returns undef if you passed it invalid arguments, so error handling is a breeze:

if( defined($hookone) ) {
        if( ref($hookone) ) {
                print "Previous reference re-defined\n";
        else {
                print "This is the first hook we've made for this message\n";
else {
        print "We passed dumb arguments.\n";

It's in the CVS now. Hopefully this will make things more useful, and allows you to create modules that "grab" hooks but still honour any hooks that the user of your module has previously defined.