Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mojo::reactor::poll(3pm) [debian man page]

Mojo::Reactor::Poll(3pm)				User Contributed Perl Documentation				  Mojo::Reactor::Poll(3pm)

NAME
Mojo::Reactor::Poll - Low level event reactor with poll support SYNOPSIS
use Mojo::Reactor::Poll; # Watch if handle becomes readable or writable my $reactor = Mojo::Reactor::Poll->new; $reactor->io($handle => sub { my ($reactor, $writable) = @_; say $writable ? 'Handle is writable' : 'Handle is readable'; }); # Add a timer $reactor->timer(15 => sub { my $reactor = shift; $reactor->remove($handle); say 'Timeout!'; }); # Start reactor if necessary $reactor->start unless $reactor->is_running; DESCRIPTION
Mojo::Reactor::Poll is a low level event reactor based on IO::Poll. Note that this reactor was designed for maximum portability, and therefore does not use a monotonic clock to handle time jumps. EVENTS
Mojo::Reactor::Poll inherits all events from Mojo::Reactor. METHODS
Mojo::Reactor::Poll inherits all methods from Mojo::Reactor and implements the following new ones. "io" $reactor = $reactor->io($handle => sub {...}); Watch handle for I/O events, invoking the callback whenever handle becomes readable or writable. "is_running" my $success = $reactor->is_running; Check if reactor is running. "one_tick" $reactor->one_tick; Run reactor until an event occurs or no events are being watched anymore. Note that this method can recurse back into the reactor, so you need to be careful. "recurring" my $id = $reactor->recurring(0.25 => sub {...}); Create a new recurring timer, invoking the callback repeatedly after a given amount of time in seconds. "remove" my $success = $reactor->remove($handle); my $success = $reactor->remove($id); Remove handle or timer. "start" $reactor->start; Start watching for I/O and timer events, this will block until "stop" is called or no events are being watched anymore. "stop" $reactor->stop; Stop watching for I/O and timer events. "timer" my $id = $reactor->timer(0.5 => sub {...}); Create a new timer, invoking the callback after a given amount of time in seconds. "watch" $reactor = $reactor->watch($handle, $readable, $writable); Change I/O events to watch handle for with "true" and "false" values. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Reactor::Poll(3pm)

Check Out this Related Man Page

Net::DBus::Binding::Server(3pm) 			User Contributed Perl Documentation			   Net::DBus::Binding::Server(3pm)

NAME
Net::DBus::Binding::Server - A server to accept incoming connections SYNOPSIS
Creating a new server and accepting client connections use Net::DBus::Binding::Server; my $server = Net::DBus::Binding::Server->new(address => "unix:path=/path/to/socket"); $server->connection_callback(&new_connection); sub new_connection { my $connection = shift; .. work with new connection... } Managing the server and new connections in an event loop my $reactor = Net::DBus::Binding::Reactor->new(); $reactor->manage($server); $reactor->run(); sub new_connection { my $connection = shift; $reactor->manage($connection); } DESCRIPTION
A server for receiving connection from client programs. The methods defined on this module have a close correspondance to the dbus_server_XXX methods in the C API, so for further details on their behaviour, the C API documentation may be of use. METHODS
my $server = Net::DBus::Binding::Server->new(address => "unix:path=/path/to/socket"); Creates a new server binding it to the socket specified by the "address" parameter. $status = $server->is_connected(); Returns zero if the server has been disconnected, otherwise a positive value is returned. $server->disconnect() Closes this server to the remote host. This method is called automatically during garbage collection (ie in the DESTROY method) if the programmer forgets to explicitly disconnect. $server->set_watch_callbacks(&add_watch, &remove_watch, &toggle_watch); Register a set of callbacks for adding, removing & updating watches in the application's event loop. Each parameter should be a code reference, which on each invocation, will be supplied with two parameters, the server object and the watch object. If you are using a "Net::DBus::Binding::Reactor" object as the application event loop, then the 'manage' method on that object will call this on your behalf. $server->set_timeout_callbacks(&add_timeout, &remove_timeout, &toggle_timeout); Register a set of callbacks for adding, removing & updating timeouts in the application's event loop. Each parameter should be a code reference, which on each invocation, will be supplied with two parameters, the server object and the timeout object. If you are using a "Net::DBus::Binding::Reactor" object as the application event loop, then the 'manage' method on that object will call this on your behalf. $server->set_connection_callback(&handler) Registers the handler to use for dealing with new incoming connections from clients. The code reference will be invoked each time a new client connects and supplied with a single parameter which is the "Net::DBus::Binding::Connection" object representing the client. AUTHOR
Daniel P. Berrange COPYRIGHT
Copyright (C) 2004-2011 Daniel P. Berrange SEE ALSO
Net::DBus::Binding::Connection, Net::DBus::Binding::Bus, Net::DBus::Binding::Message::Signal, Net::DBus::Binding::Message::MethodCall, Net::DBus::Binding::Message::MethodReturn, Net::DBus::Binding::Message::Error perl v5.14.2 2011-06-30 Net::DBus::Binding::Server(3pm)
Man Page