Re: Newbie question about sessions
"Mark Morgan" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
It should be, it needs to be called with the appropriate session id
though, without, you'll just get it quietly ignored (a warning on this
may be a good idea, I may submit a patch for that, whilst I think of
it). :(
==========
#!/usr/bin/perl
use strict;
use warnings;
use POE;
POE::Session->create(
inline_states => {
_start => sub {
print "starting\n";
$_[ KERNEL ]->refcount_increment( $_[ SESSION ]->ID );
},
}
);
POE::Kernel->run;
print "done\n";
========
With the increment there, you'll never get the 'done', without it, or
with no parameter to refcount_increment, you'll get 'done'
immediately.
Mark.
On Tue, Oct 7, 2008 at 6:30 PM, Artem Harutyunyan <[email protected]> wrote:
>>
>> ,blah_evt => sub{ $_[KERNEL]->delay( blah_evt => 10 }
>
> OK. But why reference count trick is not working ?
>
>>
>> --- On Tue, 10/7/08, Artem Harutyunyan <[email protected]> wrote:
>>
>> From: Artem Harutyunyan <[email protected]>
>> Subject: Re: Newbie question about sessions
>> To: [email protected]
>> Cc: [email protected]
>> Date: Tuesday, October 7, 2008, 10:35 AM
>>
>> Hi Alex,
>>
>>>
>>> POE::Kernel->post ('worker' => 'random');
>>> POE::Kernel->run();
>>
>> Yes, that works. However this doesn't solve my problem. I want session
>> to stay alive and wait for (possible) future events. (I will need that
>> when I will use my class inside a server).
>>
>> Artem.
>>
>