… | |
… | |
259 | && &{$_->[0]} |
259 | && &{$_->[0]} |
260 | && undef $_; |
260 | && undef $_; |
261 | } |
261 | } |
262 | |
262 | |
263 | for (@{ $port->{any} }) { |
263 | for (@{ $port->{any} }) { |
264 | $_ && [@_[0..$#{$_->[1]}]] ~~ $_->[1] |
264 | $_ && [@_[0..$#{$_->[1]}]] ~~ $_->[1] |
265 | && &{$_->[0]} |
265 | && &{$_->[0]} |
266 | && undef $_; |
266 | && undef $_; |
267 | } |
267 | } |
268 | } |
268 | } |
269 | |
269 | |
… | |
… | |
397 | } |
397 | } |
398 | |
398 | |
399 | $NODE{""} = new AnyEvent::MP::Node::Self noderef => $NODE; |
399 | $NODE{""} = new AnyEvent::MP::Node::Self noderef => $NODE; |
400 | _new_port ""; |
400 | _new_port ""; |
401 | |
401 | |
|
|
402 | =item devnull => ... |
|
|
403 | |
|
|
404 | Generic data sink/CPU heat conversion. |
|
|
405 | |
|
|
406 | =cut |
|
|
407 | |
|
|
408 | rcv "", devnull => sub { () }; |
|
|
409 | |
402 | =item relay => $port, @msg |
410 | =item relay => $port, @msg |
403 | |
411 | |
404 | Simply forwards the message to the given port. |
412 | Simply forwards the message to the given port. |
405 | |
413 | |
406 | =cut |
414 | =cut |
407 | |
415 | |
408 | rcv "", relay => \&snd; |
416 | rcv "", relay => sub { \&snd; () }; |
409 | |
417 | |
410 | =item eval => $string[ @reply] |
418 | =item eval => $string[ @reply] |
411 | |
419 | |
412 | Evaluates the given string. If C<@reply> is given, then a message of the |
420 | Evaluates the given string. If C<@reply> is given, then a message of the |
413 | form C<@reply, $@, @evalres> is sent. |
421 | form C<@reply, $@, @evalres> is sent. |
… | |
… | |
420 | |
428 | |
421 | rcv "", eval => sub { |
429 | rcv "", eval => sub { |
422 | my (undef, $string, @reply) = @_; |
430 | my (undef, $string, @reply) = @_; |
423 | my @res = eval $string; |
431 | my @res = eval $string; |
424 | snd @reply, "$@", @res if @reply; |
432 | snd @reply, "$@", @res if @reply; |
|
|
433 | () |
425 | }; |
434 | }; |
426 | |
435 | |
427 | =item time => @reply |
436 | =item time => @reply |
428 | |
437 | |
429 | Replies the the current node time to C<@reply>. |
438 | Replies the the current node time to C<@reply>. |
… | |
… | |
434 | snd $NODE, time => $myport, timereply => 1, 2; |
443 | snd $NODE, time => $myport, timereply => 1, 2; |
435 | # => snd $myport, timereply => 1, 2, <time> |
444 | # => snd $myport, timereply => 1, 2, <time> |
436 | |
445 | |
437 | =cut |
446 | =cut |
438 | |
447 | |
439 | rcv "", time => sub { shift; snd @_, AE::time }; |
448 | rcv "", time => sub { shift; snd @_, AE::time; () }; |
440 | |
449 | |
441 | =back |
450 | =back |
442 | |
451 | |
443 | =head1 SEE ALSO |
452 | =head1 SEE ALSO |
444 | |
453 | |