Aldo Calpini wrote:
> 
> arguments to -events can be:
>   - a subroutine name (string)
>   - a reference (eg. \&)
>   - an anonymous sub (eg. sub { .. })


Both of the following items prevent me from porting certain Win32::GUI
applications to the New Event Model.

There doesn't seem to be a way to...

1) discover the code ref for an event handler, in case you want to wrap
it in a more powerful handler, or chain the handlers, when using layered
or modular software techniques.  Something like the following could be a
possible interface:

$coderef = $mw->GetEventHandler ( "Terminate" );

2) execute an event handler.  Something like the following could be the
interface:

$mw->CallEventHandler ( "Terminate", @pass_through_parameters );

The handler itself would then be called with the window/control name as
its first parameter, followed with the @pass_through_parameters.  The
handler's return value would be returned from CallEventHandler, but it
would generally be discarded in cases like this I suspect.

Clearly (1) is more powerful than (2), since if you can discover the
code ref, then you could clearly execute it... but (2) could be
convenient syntactic sugar for recoding cases like (old style event
model) shutting down all windows when the main window is closed:

sub Main_Terminate
{ # print "Main_Terminate\n";
  & LB_Terminate ();
  & PR_Terminate ();
  & ED_Terminate ();
  return -1;
}

-- 
Glenn
=====
Remember, 84.3% of all statistics are made up on the spot.

Reply via email to