ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP.pm
(Generate patch)

Comparing AnyEvent-MP/MP.pm (file contents):
Revision 1.143 by root, Fri Mar 23 17:54:36 2012 UTC vs.
Revision 1.144 by root, Fri Mar 23 21:16:25 2012 UTC

183 183
184package AnyEvent::MP; 184package AnyEvent::MP;
185 185
186use AnyEvent::MP::Config (); 186use AnyEvent::MP::Config ();
187use AnyEvent::MP::Kernel; 187use AnyEvent::MP::Kernel;
188use AnyEvent::MP::Kernel qw(%NODE %PORT %PORT_DATA $UNIQ $RUNIQ $ID); 188use AnyEvent::MP::Kernel qw(
189 %NODE %PORT %PORT_DATA $UNIQ $RUNIQ $ID
190 add_node load_func
191
192 NODE $NODE
193 configure
194 node_of port_is_local
195 snd kil
196 db_set db_del
197 db_mon db_family db_keys db_values
198);
189 199
190use common::sense; 200use common::sense;
191 201
192use Carp (); 202use Carp ();
193 203
197use base "Exporter"; 207use base "Exporter";
198 208
199our $VERSION = $AnyEvent::MP::Config::VERSION; 209our $VERSION = $AnyEvent::MP::Config::VERSION;
200 210
201our @EXPORT = qw( 211our @EXPORT = qw(
202 NODE $NODE *SELF node_of after 212 NODE $NODE
203 configure 213 configure
214 node_of port_is_local
215 snd kil
216 db_set db_del
217 db_mon db_family db_keys db_values
218
219 *SELF
220
204 snd rcv mon mon_guard kil psub peval spawn cal 221 port rcv mon mon_guard psub peval spawn cal
205 port
206 db_set db_del db_reg 222 db_set db_del db_reg
207 db_mon db_family db_keys db_values 223 db_mon db_family db_keys db_values
224
225 after
208); 226);
209 227
210our $SELF; 228our $SELF;
211 229
212sub _self_die() { 230sub _self_die() {
222a call to C<configure>. 240a call to C<configure>.
223 241
224=item $nodeid = node_of $port 242=item $nodeid = node_of $port
225 243
226Extracts and returns the node ID from a port ID or a node ID. 244Extracts and returns the node ID from a port ID or a node ID.
245
246=item $is_local = port_is_local $port
247
248Returns true iff the port is a local port.
227 249
228=item configure $profile, key => value... 250=item configure $profile, key => value...
229 251
230=item configure key => value... 252=item configure key => value...
231 253
464 486
465sub rcv($@) { 487sub rcv($@) {
466 my $port = shift; 488 my $port = shift;
467 my ($nodeid, $portid) = split /#/, $port, 2; 489 my ($nodeid, $portid) = split /#/, $port, 2;
468 490
469 $NODE{$nodeid} == $NODE{""} 491 $nodeid eq $NODE
470 or Carp::croak "$port: rcv can only be called on local ports, caught"; 492 or Carp::croak "$port: rcv can only be called on local ports, caught";
471 493
472 while (@_) { 494 while (@_) {
473 if (ref $_[0]) { 495 if (ref $_[0]) {
474 if (my $self = $PORT_DATA{$portid}) { 496 if (my $self = $PORT_DATA{$portid}) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines