On Sat, Jan 26, 2002 at 06:00:06PM -0600, [EMAIL PROTECTED] wrote: > I wrote a function for POE::Kernel called 'kill_session', oddly enough, it > forces the removal of a session that you specify. All children of the > session move up and become children of the grandparent, and all of the > dispatching is taken care of for this.
Sweet! I've finally got something to put in the empty RFCs page! http://poe.perl.org/?POE_RFCs/Explicitly_stop_sessions > The problem is, I have no clue how to subclass POE::Kernel, my attempt is > located at http://kuiki.net/hachi/Kernel-killable.pm.txt [...] > If someone wants to help me out with subclassing this sucker properly, > thanks. Otherwise you can just shove the function into Kernel.pm and it will > work. All you're doing is adding a new function to Kernel.pm? It should be easy enough to do without any subclassing. Here's what you're trying: package POE::Kernel-killable; use strict; use base qe(POE::Kernel); use POE::Preprocessor (isa => 'POE::Kernel'); use POE::Kernel; @ISA = qw(POE::Kernel); # Kill a session, forcefully, hopefully. sub kill_session { # code omitted... } 1; I do something similar in the POE::Kernel::* event loop interfaces. They don't do direct inheritance. Rather, they jump into POE::Kernel's package and insert stuff directly. Yeah, it's not nice, but it's how the Kernel's plug-ins work. So here's something to try: # Empty package to appease perl. package POE::Kernel::Select; use strict; use vars qw($VERSION); $VERSION = (qw($Revision$ ))[1]; # Everything plugs into POE::Kernel. package POE::Kernel; use strict; # Kill a session, forcefully, hopefully. sub kill_session { # code omitted... } 1; Any macros that are defined here will also be placed in Kernel's namespace. That's how POE::Kernel::* insert loop-specific code into POE::Kernel's main logic. -- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net
