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.6 by root, Sat Aug 1 10:02:33 2009 UTC vs.
Revision 1.7 by root, Sat Aug 1 15:04:30 2009 UTC

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
404Generic data sink/CPU heat conversion.
405
406=cut
407
408rcv "", devnull => sub { () };
409
402=item relay => $port, @msg 410=item relay => $port, @msg
403 411
404Simply forwards the message to the given port. 412Simply forwards the message to the given port.
405 413
406=cut 414=cut
407 415
408rcv "", relay => \&snd; 416rcv "", relay => sub { \&snd; () };
409 417
410=item eval => $string[ @reply] 418=item eval => $string[ @reply]
411 419
412Evaluates the given string. If C<@reply> is given, then a message of the 420Evaluates the given string. If C<@reply> is given, then a message of the
413form C<@reply, $@, @evalres> is sent. 421form C<@reply, $@, @evalres> is sent.
420 428
421rcv "", eval => sub { 429rcv "", 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
429Replies the the current node time to C<@reply>. 438Replies 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
439rcv "", time => sub { shift; snd @_, AE::time }; 448rcv "", time => sub { shift; snd @_, AE::time; () };
440 449
441=back 450=back
442 451
443=head1 SEE ALSO 452=head1 SEE ALSO
444 453

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines