Hello, Bruno,

> 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,

yes, Event is well suited for this purpose.


> i made the following testscript:
>
> #!/usr/bin/perl -w
> use Event qw(loop);
> require Event::timer;

A Note: Event::timer does not need to be required explicitly.


> the unloop method found in the docu isn't recognized at runtime...

Please import unloop() by

  use Event qw(loop unloop);


> (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....

The script does not really block, but it is running in the Event loop
waiting for registered events, so all code following the call of loop()
will be delayed until the loop is leaved. Please see the illustrations in
the tutorial.

This means you *can* do other things while waiting for your timer, but you
need to arrange them by more watcher callbacks. A convenient way to do this
is to use an idle watcher with a short running callback (working as a state
machine, if necessary) which will be invoked whenever no other event is
detected.

                        Jochen





Reply via email to