Net::DBus::Binding::Server - A server to accept incoming connections
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); }
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.
Creates a new server binding it to the socket specified by the address parameter.
address
Returns zero if the server has been disconnected, otherwise a positive value is returned.
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.
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.
Net::DBus::Binding::Reactor
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.
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.
Net::DBus::Binding::Connection
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
Daniel Berrange <dan@berrange.com>
Copyright 2004 by Daniel Berrange
To install Net::DBus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DBus
CPAN shell
perl -MCPAN -e shell install Net::DBus
For more information on module installation, please visit the detailed CPAN module installation guide.