/usr/lib/perl5/Spread.pm is in libspread-perl 3.17.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | # Filename: Spread.pm
# Author: Theo Schlossnagle <jesus@cnds.jhu.edu>
# Created: 12th October 1999
# Version: 1.03152
#
# Copyright (c) 1999-2001 Theo Schlossnagle. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
#
package Spread;
require 5.004;
require Exporter;
require DynaLoader;
require AutoLoader;
use Carp;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
$VERSION = "3.17.0-1.04" ;
*SP_connect = \&Spread::connect;
*SP_disconnect = \&Spread::disconnect;
*SP_join = \&Spread::join;
*SP_leave = \&Spread::leave;
*SP_receive = \&Spread::receive;
*SP_multicast = \&Spread::multicast;
*SP_poll = \&Spread::poll;
*SP_version = \&Spread::version;
@ISA = qw(Exporter DynaLoader);
%EXPORT_TAGS = (
MESS => [ qw(UNRELIABLE_MESS
RELIABLE_MESS
FIFO_MESS
CAUSAL_MESS
AGREED_MESS
SAFE_MESS
REGULAR_MESS
SELF_DISCARD
DROP_RECV
REG_MEMB_MESS
TRANSITION_MESS
CAUSED_BY_JOIN
CAUSED_BY_LEAVE
CAUSED_BY_DISCONNECT
CAUSED_BY_NETWORK
MEMBERSHIP_MESS) ],
ERROR => [ qw($sperrno
ACCEPT_SESSION
ILLEGAL_GROUP
ILLEGAL_MESSAGE
ILLEGAL_SERVICE
ILLEGAL_SESSION
ILLEGAL_SPREAD
CONNECTION_CLOSED
COULD_NOT_CONNECT
MESSAGE_TOO_LONG
BUFFER_TOO_SHORT
GROUPS_TOO_SHORT
REJECT_ILLEGAL_NAME
REJECT_NOT_UNIQUE
REJECT_NO_NAME
REJECT_QUOTA
REJECT_VERSION) ],
SP => [ qw(SP_connect
SP_disconnecct
SP_join
SP_leave
SP_receive
SP_multicast
SP_poll
SP_version
) ],
);
@EXPORT = qw(
$sperrno
UNRELIABLE_MESS
RELIABLE_MESS
FIFO_MESS
CAUSAL_MESS
AGREED_MESS
SAFE_MESS
REGULAR_MESS
SELF_DISCARD
DROP_RECV
REG_MEMB_MESS
TRANSITION_MESS
CAUSED_BY_JOIN
CAUSED_BY_LEAVE
CAUSED_BY_DISCONNECT
CAUSED_BY_NETWORK
MEMBERSHIP_MESS
ACCEPT_SESSION
ILLEGAL_GROUP
ILLEGAL_MESSAGE
ILLEGAL_SERVICE
ILLEGAL_SESSION
ILLEGAL_SPREAD
CONNECTION_CLOSED
COULD_NOT_CONNECT
BUFFER_TOO_SHORT
GROUPS_TOO_SHORT
MESSAGE_TOO_LONG
REJECT_ILLEGAL_NAME
REJECT_NOT_UNIQUE
REJECT_NO_NAME
REJECT_QUOTA
REJECT_VERSION
SP_connect
SP_disconnecct
SP_join
SP_leave
SP_receive
SP_multicast
SP_poll
SP_version
);
*EXPORT_OK = \@EXPORT;
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
# XS function. If a constant is not found then control is passed
# to the AUTOLOAD in AutoLoader.
my $constname;
($constname = $AUTOLOAD) =~ s/.*:://;
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
if ($! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
else {
croak "Your vendor has not defined Spread macro $constname";
}
}
eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
}
bootstrap Spread $VERSION ;
sub connect {
my($aa) = shift;
$$aa{'private_name'} = $ENV{'USER'} unless defined($$aa{'private_name'});
$$aa{'priority'} = 0 unless defined($$aa{'priority'});
$$aa{'group_membership'} = 1 unless defined($$aa{'group_membership'});
return connect_i($aa);
}
1;
1;
__END__
# Below is the stub of documentation for your module. You better edit it!
=head1 NAME
Spread - Perl extension for the Spread group communication system
=head1 SYNOPSIS
use Spread;
# Connect
my($mailbox, $private_group) = Spread::connect(
spread_name => '4444@host.domain.com',
private_name => 'mrcool',
);
# Join and leave groups
my(@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 mailbox
my($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
# Disconnect
if(Spread::disconnect($mbox)) { print "Successful disconnect\n"; }
else { print "Spread::disconnect -- $sperrorno\n"; }
=head1 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.
=head1 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_SESSION
AGREED_MESS
BUFFER_TOO_SHORT
CAUSAL_MESS
CAUSED_BY_DISCONNECT
CAUSED_BY_JOIN
CAUSED_BY_LEAVE
CAUSED_BY_NETWORK
CONNECTION_CLOSED
COULD_NOT_CONNECT
FIFO_MESS
HIGH_PRIORITY
ILLEGAL_GROUP
ILLEGAL_MESSAGE
ILLEGAL_SERVICE
ILLEGAL_SESSION
ILLEGAL_SPREAD
LOW_PRIORITY
MAX_SCATTER_ELEMENTS
MEDIUM_PRIORITY
MEMBERSHIP_MESS
REGULAR_MESS
REG_MEMB_MESS
REJECT_ILLEGAL_NAME
REJECT_NOT_UNIQUE
REJECT_NO_NAME
REJECT_QUOTA
REJECT_VERSION
RELIABLE_MESS
SAFE_MESS
SELF_DISCARD
TRANSITION_MESS
UNRELIABLE_MESS
=head1 AUTHOR
Theo Schlossnagle <jesus@cnds.jhu.edu>
=head1 SEE ALSO
Various spread documentation at http://www.spread.org/.
=cut
|