Hello!

sorry to bother, but i am kinda stuck trying to understand the
Event::timer part...

What i was looking for was a timoutmechanism to close idle sessions in a
script... From the description i think that the Event module is suited,
  but i didn't manage to get an asynchronous system to work...

i made the following testscript:

#!/usr/bin/perl -w
use Event qw(loop);
require Event::timer;

my $next = Event::time()+rand(3);
print "setting time to ".($next-Event::time())."s\n";

my $w = Event->timer(at => $next, parked =>1);
$w->cb( \&printer );
print "started printer\n";
$w->start();
print "going into sleep:\n";
my $toto = loop();
#my $toto = unloop('ok');

sub printer 
{
  print "printer!!!\n";
  #unloop('ok');
}
#sleep(30);

the unloop method found in the docu isn't recognized at runtime...
(i am using version 0.83)
the script above works only in blocking manner, means as soon as the
loop function is called, the whole script blocks until the timeout...

So i was wondering if there wasn't a non blocking way to achieve this,
since putting this into a forked process isn't really what was
announced in the philosophy of the docu....


-- 
ciao bboett
==============================================================
[EMAIL PROTECTED]
http://inforezo.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....

Reply via email to