AnyEvent-SIP
view release on metacpan or search on metacpan
...
DESCRIPTION
This module allows you to use AnyEvent as the event loop (and thus any
other supported event loop) for Net::SIP.
Net::SIP::Simple allows you to define the event loop. You can either
define it using Net::SIP::Dispatcher::AnyEvent manually or you can
simply use AnyEvent::SIP which will automatically set it for you.
# doing it automatically and globally
use AnyEvent::SIP;
use Net::SIP::Simple;
my $cv = AE::cv;
my $ua = Net::SIP::Simple->new(...);
$ua->register( cb_final => sub { $cv->send } );
$cv->recv;
# defining it for a specific object
use Net::SIP::Simple;
my $ua = Net::SIP::Simple->(
...
loop => Net::SIP::Dispatcher::AnyEvent->new,
);
$ua->register;
$cv->recv;
You can also call Net::SIP's "loop" method in order to keep it as close
as possible to the original syntax. This will internally use AnyEvent,
whether you're using AnyEvent::SIP globally or
Net::SIP::Dispatcher::AnyEvent locally.
use AnyEvent::SIP;
use Net::SIP::Simple;
my $stopvar;
my $ua = Net::SIP::Simple->new(...);
$ua->register( cb_final => sub { $stopvar++ } );
# call Net::SIP's event loop runner,
lib/AnyEvent/SIP.pm view on Meta::CPAN
=head1 DESCRIPTION
This module allows you to use L<AnyEvent> as the event loop (and thus any
other supported event loop) for L<Net::SIP>.
L<Net::SIP::Simple> allows you to define the event loop. You can either define
it using L<Net::SIP::Dispatcher::AnyEvent> manually or you can simply use
L<AnyEvent::SIP> which will automatically set it for you.
# doing it automatically and globally
use AnyEvent::SIP;
use Net::SIP::Simple;
my $cv = AE::cv;
my $ua = Net::SIP::Simple->new(...);
$ua->register( cb_final => sub { $cv->send } );
$cv->recv;
# defining it for a specific object
use Net::SIP::Simple;
lib/AnyEvent/SIP.pm view on Meta::CPAN
my $ua = Net::SIP::Simple->(
...
loop => Net::SIP::Dispatcher::AnyEvent->new,
);
$ua->register;
$cv->recv;
You can also call L<Net::SIP>'s C<loop> method in order to keep it as close as
possible to the original syntax. This will internally use L<AnyEvent>, whether
you're using L<AnyEvent::SIP> globally or L<Net::SIP::Dispatcher::AnyEvent>
locally.
use AnyEvent::SIP;
use Net::SIP::Simple;
my $stopvar;
my $ua = Net::SIP::Simple->new(...);
$ua->register( cb_final => sub { $stopvar++ } );
# call Net::SIP's event loop runner,
( run in 1.948 second using v1.01-cache-2.11-cpan-49f99fa48dc )