Re: Question on Reloading Modules in POE server
Rocco Caputo <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
POE's "odd" double-indirection means that only POE::Session holds
references to your code:
POE::Session->create(
{
inline_states => {
event_name => \&your_code,
...,
}
}
);
Everything else refers to handlers by event name.
Reloading the code isn't enough for inline_states since the session is
still referring to the old handlers. In this case, a session must use
POE::Kernel's state() to redefine its event handlers in terms of the
new code.
From POE's perspective there should be no additional work for object-
or package-based handlers.
--
Rocco Caputo - [email protected]
On Oct 27, 2008, at 10:56, ty wrote:
> I have a POE server that spawns some sessions that use
> POE::Component::Generic. Each of these sessions act as a separate
> tool in the server. From time to time, I have to make changes to a
> module that is used by one of the sessions. It requires me to restart
> the server now so that the new changes are reflected. It would be
> nice if there was a way to tell the session to reload the module like
> it is possible in mod_perl with various apache modules. I came across
> a post on this group in 2005 titled Unuse Modules, but this was
> looking at the problem from getting them out of the system not
> reloading. Module::Refresh seems to be a possible solution. However,
> I wanted to know if anyone has successfully done something like this
> in the context of POE running in a persistent environment?
>
> Best Regards
>
> Ty
>