The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::SIP::Dispatcher::AnyEvent - AnyEvent dispatcher for Net::SIP

VERSION

version 0.002

DESCRIPTION

This module allows Net::SIP to work with AnyEvent as the event loop, instead of its own. This means you can combine them.

While this is the implementation itself, you probably want to use AnyEvent::SIP instead. You definitely want to read the documentation there instead of here. Go ahead, click the link. :)

The rest only documents how the loop implementation works. If you use this directly, the only method you care about is loop.

WARNING

The compatible mode of Net::SIP::Dispatcher::AnyEvent is pretty stressful on your CPU. Please read the compatibility mode section in AnyEvent::SIP.

ATTRIBUTES

_net_sip_compat

Whether to be fully compatible with Net::SIP with the expense of possible side-effects on the CPU load of your processes. Please read compatibility mode in AnyEvent::SIP.

_ae_interval

In normal (non-compatible) mode, how often to check for stopvars. Default: 0.2 seconds.

INTERNAL ATTRIBUTES

These attributes have no accessors, they are saved as internal keys.

_idle

Hold the AnyEvent::AggressiveIdle object that checks stopvars.

_stopvar

Condition variables to be checked for stopping the loop.

_cv

Main condition variable allowing for looping.

_fd_watchers

All the watched file descriptors.

_stopvar_timer

Timer holding stopvar checking. Only for default non-compatible mode.

METHODS

new

The object constructor. It creates a default CondVar in _cv hash key, and sets an aggressive idle CondVar in the _idle hash key, which checks the stopvars every loop cycle.

addFD($fd, $cb_data, [$name])

Add a file descriptor to watch input for, and a callback to run when it's ready to be read.

delFD($fd)

Delete the watched file descriptor.

add_timer($when, $cb_data, [$repeat], [$name])

Create a timer to run a callback at a certain point in time. If the time is considerably far (3,600 * 24 * 365 and up), it's a specific point in time. Otherwise, it's a number of seconds from now.

The repeat option is an optional interval for the timer.

looptime

Provide the event loop time.

loop($timeout, [\@stopvars])

Run the event loop and wait for all events to finish (whether by timeout or stopvars becoming true).

AUTHOR

Sawyer X <xsawyerx@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Sawyer X.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.