NAME
Spread - Perl extension for the Spread group communication system
SYNOPSIS
use Spread;# Connectmy($mailbox, $private_group) = Spread::connect(spread_name => '[email protected]',private_name => 'mrcool',);# Join and leave groupsmy(@group_to_join) = ( 'GroupA', 'GroupB', 'GroupC' );my(@joined_groups) = grep( Spread::join($mbox, $_), @group_to_join );print "Spread::join -- $sperrorno"unless (Spread::leave($mbox, 'GroupC'));# Multicast to group(s)Spread::multicast($mbox, AGREED_MESS, 'GroupB', 0, "Hey you!");Spread::multicast($mbox, SAFE_MESS, @joined_groups, 0, "Hey yall!");# Poll mailboxmy($messsize) = Spread::poll($mbox);if(defined($messsize)) { print "Next message: $messsize bytes\n"; }else { print "Spread::poll $sperrno\n"; }# Receive messages (see spread's man pages for more description)my($service_type, $sender, $groups, $mess_type, $endian, $message) =Spread::receive($mbox);my($service_type, $sender, $groups, $mess_type, $endian, $message) =Spread::receive($mbox, 1.789); # 1.789 second timeout on receive# Disconnectif(Spread::disconnect($mbox)) { print "Successful disconnect\n"; }else { print "Spread::disconnect -- $sperrorno\n"; }
DESCRIPTION
Understanding through practice ;)
See man pages for SP_connect, SP_join, SP_multicast, SP_receive, SP_poll, SP_error, SP_leave, SP_disconnect.
$sperror holds either the integer spread error or a descriptive string depending on the context in which $sperror is used.
Exported constants
The predefined groups of exports in the use statements are as follows:
use Spread qw(:SP);
Exports the Spread::connect, Spread::join, Spread::multicast, Spread::receive, Spread::poll, Spread::error, Spread::leave, and Spread::disconnect as SP_connect, SP_join, SP_multicast, SP_receive, SP_poll, SP_error, SP_leave, and SP_disconnect, respectively.
use Spread qw(:ERROR);
Exports all of the error conditions. Please refer to the SP_* C man pages as the "RETURN VALUES" there have both identical spellings and meanings.
use Spread qw(:MESS);
Exports all of the message types (this is returned as service type by the Spread::receive function and is the request service type of the Spread::multicast function). The actual meaning of these orderings and assurances are not simple to explain without a basic understanding of group communication systems. For more information on this topic, please visit the Spread web site at http://www.spread.org/
All constants in alphabetical order:
ACCEPT_SESSIONAGREED_MESSBUFFER_TOO_SHORTCAUSAL_MESSCAUSED_BY_DISCONNECTCAUSED_BY_JOINCAUSED_BY_LEAVECAUSED_BY_NETWORKCONNECTION_CLOSEDCOULD_NOT_CONNECTFIFO_MESSHIGH_PRIORITYILLEGAL_GROUPILLEGAL_MESSAGEILLEGAL_SERVICEILLEGAL_SESSIONILLEGAL_SPREADLOW_PRIORITYMAX_SCATTER_ELEMENTSMEDIUM_PRIORITYMEMBERSHIP_MESSREGULAR_MESSREG_MEMB_MESSREJECT_ILLEGAL_NAMEREJECT_NOT_UNIQUEREJECT_NO_NAMEREJECT_QUOTAREJECT_VERSIONRELIABLE_MESSSAFE_MESSSELF_DISCARDTRANSITION_MESSUNRELIABLE_MESS
AUTHOR
Theo Schlossnagle <[email protected]>
SEE ALSO
Various spread documentation at http://www.spread.org/.