This is how I intercept xxx_Terminate, which I do to write something to the registry when the program exits. For the whole picture, see WinSize.pm @ www.fairymails.com/perl/ <http://www.fairymails.com/perl/>
# must bottle this up inside eval eval qq ( # get pointer to current sub. $_ holds name of window # &main:: notion required because this script is a module \$currterm = \\&main::$_\_Terminate; # redefine sub (to do nothing but call another sub) sub $_\_Terminate {Terminate ()} # must alter the pointer in the main namespace *main::$_\_Terminate = \\&$_\_Terminate; ); # now the following function gets called by the new xxx_Terminate sub sub Terminate { # ... do your intercept stuff here, e.g. return 0 unless areyousure ('wanna quit?'); # get pointer to previous (intercepted) sub $_ = $$currterm; # call the previous sub if there was one, if not, provide default return defined &$_ ? &$_ : -1; } Hope that helps - it's no way of capturing all subs there might be, as your reference to AUTOLOAD suggests you want to have. For that, you will need to shoot a hole into the XS code. Have fun, Harald > -----Original Message----- > From: Forhan, Michael [ <mailto:[EMAIL PROTECTED]> mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 18, 2001 12:15 > To: 'perl-win32-gui-users@lists.sourceforge.net' > Subject: [perl-win32-gui-users] FW: Win32::GUI Events > > > > > > -----Original Message----- > > From: Forhan, Michael > > Sent: Friday, July 13, 2001 1:10 PM > > To: 'perl-win32-gui-users@lists.sourceforge.net' > > Subject: Win32::GUI Events > > > > Is there a way to 'intercept' a call to a subroutine, and handle it > > elsewhere? I'm aware that if a subroutine is called, but > doesn't exist, > > you can use a 'sub AUTOLOAD {' and reference '$AUTOLOAD' to > get the name > > of the subroutine that the program is after. Unfortunately, > this doesn't > > seem to function for Events (if I leave out the > Cancel_Click event for > > instance, Autoload is never hit) I've been thinking about > designing a > > subroutine that just analyzes the type of event requested > and performs > > different processes according to the type. > > > > Thanks, > > -Mike > > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > <http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users> http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >