AnyEvent::MP

Erlang-style multi-processing/message-passing framework
Download

AnyEvent::MP Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Marc Lehmann
  • Publisher web site:
  • http://www.goof.com/pcg/marc/

AnyEvent::MP Tags


AnyEvent::MP Description

Erlang-style multi-processing/message-passing framework AnyEvent::MP is a Perl module (-family) that implements a simple message passing framework.Despite its simplicity, you can securely message other processes running on the same or other hosts, and you can supervise entities remotely.For an introduction to this module family, see the AnyEvent::MP::Intro manual page and the examples under eg/.SYNOPSIS use AnyEvent::MP; $NODE # contains this node's node ID NODE # returns this node's node ID $SELF # receiving/own port id in rcv callbacks # initialise the node so it can send/receive messages configure; # ports are message destinations # sending messages snd $port, type => data...; snd $port, @msg; snd @msg_with_first_element_being_a_port; # creating/using ports, the simple way my $simple_port = port { my @msg = @_ }; # creating/using ports, tagged message matching my $port = port; rcv $port, ping => sub { snd $_, "pong" }; rcv $port, pong => sub { warn "pong received\n" }; # create a port on another node my $port = spawn $node, $initfunc, @initdata; # destroy a prot again kil $port; # "normal" kill kil $port, my_error => "everything is broken"; # error kill # monitoring mon $localport, $cb->(@msg) # callback is invoked on death mon $localport, $otherport # kill otherport on abnormal death mon $localport, $otherport, @msg # send message on death # temporarily execute code in port context peval $port, sub { die "kill the port!" }; # execute callbacks in $SELF port context my $timer = AE::timer 1, 0, psub { die "kill the port, delayed"; }; Requirements: · Perl


AnyEvent::MP Related Software