|
/Users/cpanrun/depot/main/contrib-patched/perl/CPAN/src/Net-Msmgr/blib/lib/Net/Msmgr/Connection.pm |
Net::Msmgr::Connection
use Net::Msmgr::Connection;
my $session = Net::Msmgr::Sesssion->new(....); my $connection = new Net::Msmgr::Connection;
$connection->nserver( ip-address or hostname );
$connection->nsport( 1863 ); # default port #
$connection->name('Descriptive Name'); # used in debugging output
$connection->session($session); # associate with a session
$connection->debug($debugflags); # lots of options here
$connection->connect; # open the connection
=head1 DESCRIPTION
Net::Msmgr::Connection is the encapsulation for a connection to an Net::Msmgr Dispatch Server, Notification Server, or Switchboard Server. It will instantiate Event watchers to empty the transmit queue as messages are sent through it, and dispatch messages as they are received from the network, calling a list of per-message handlers.
my $connection = new Net::Msmgr::Connection( ... );
- or -
my $connection = Net::Msmgr::Command->new( ... );
Constructor parameters are:
Message Handlers can be registered for each of the inbound messages. All message handlers are called with at least one parameter, the Net::Msmgr::Command object encapsulating the message. Optionally, you can at registration time add extra parameters to that list.
Handlers look like 'methodname' which will turn into a $session->methodname($command); If handler is an array ref, the first element is a session handler, and the following elements will be passed as the second through nth parameters to that handler. A handler 'nonmethod' exists to allow you to call arbitrary code.
An example:
my $code = sub { my ($c,$t) = @_; print STDERR $t , $c->as_text } ;
$ns->add_handler( [ 'nonmethod', $code, 'test_handler' ] , 'QNG' );
|
/Users/cpanrun/depot/main/contrib-patched/perl/CPAN/src/Net-Msmgr/blib/lib/Net/Msmgr/Connection.pm |