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.72 by root, Mon Aug 31 10:07:04 2009 UTC vs.
Revision 1.74 by root, Mon Aug 31 11:11:27 2009 UTC

21 snd $port, type => data...; 21 snd $port, type => data...;
22 snd $port, @msg; 22 snd $port, @msg;
23 snd @msg_with_first_element_being_a_port; 23 snd @msg_with_first_element_being_a_port;
24 24
25 # creating/using ports, the simple way 25 # creating/using ports, the simple way
26 my $simple_port = port { my @msg = @_; 0 }; 26 my $simple_port = port { my @msg = @_ };
27 27
28 # creating/using ports, tagged message matching 28 # creating/using ports, tagged message matching
29 my $port = port; 29 my $port = port;
30 rcv $port, ping => sub { snd $_[0], "pong"; 0 }; 30 rcv $port, ping => sub { snd $_[0], "pong" };
31 rcv $port, pong => sub { warn "pong received\n"; 0 }; 31 rcv $port, pong => sub { warn "pong received\n" };
32 32
33 # create a port on another node 33 # create a port on another node
34 my $port = spawn $node, $initfunc, @initdata; 34 my $port = spawn $node, $initfunc, @initdata;
35 35
36 # monitoring 36 # monitoring
231Example: configure a node using a profile called seed, which si suitable 231Example: configure a node using a profile called seed, which si suitable
232for a seed node as it binds on all local addresses on a fixed port (4040, 232for a seed node as it binds on all local addresses on a fixed port (4040,
233customary for aemp). 233customary for aemp).
234 234
235 # use the aemp commandline utility 235 # use the aemp commandline utility
236 # aemp profile seed setnodeid anon/ setbinds '*:4040' 236 # aemp profile seed nodeid anon/ binds '*:4040'
237 237
238 # then use it 238 # then use it
239 configure profile => "seed"; 239 configure profile => "seed";
240 240
241 # or simply use aemp from the shell again: 241 # or simply use aemp from the shell again:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines