… | |
… | |
53 | |
53 | |
54 | =item port id - C<noderef#portname> |
54 | =item port id - C<noderef#portname> |
55 | |
55 | |
56 | A port id is normaly the concatenation of a noderef, a hash-mark (C<#>) as |
56 | A port id is normaly the concatenation of a noderef, a hash-mark (C<#>) as |
57 | separator, and a port name (a printable string of unspecified format). An |
57 | separator, and a port name (a printable string of unspecified format). An |
58 | exception is the the node port, whose ID is identical to it's node |
58 | exception is the the node port, whose ID is identical to its node |
59 | reference. |
59 | reference. |
60 | |
60 | |
61 | =item node |
61 | =item node |
62 | |
62 | |
63 | A node is a single process containing at least one port - the node |
63 | A node is a single process containing at least one port - the node |
… | |
… | |
240 | mon $port, $self => "restart"; |
240 | mon $port, $self => "restart"; |
241 | |
241 | |
242 | =cut |
242 | =cut |
243 | |
243 | |
244 | sub mon { |
244 | sub mon { |
245 | my ($noderef, $port, $cb) = ((split /#/, shift, 2), shift); |
245 | my ($noderef, $port) = split /#/, shift, 2; |
246 | |
246 | |
247 | my $node = $NODE{$noderef} || add_node $noderef; |
247 | my $node = $NODE{$noderef} || add_node $noderef; |
248 | |
248 | |
249 | #TODO: ports must not be references |
249 | my $cb = shift; |
250 | if (!ref $cb or "AnyEvent::MP::Port" eq ref $cb) { |
250 | |
|
|
251 | unless (ref $cb) { |
251 | if (@_) { |
252 | if (@_) { |
252 | # send a kill info message |
253 | # send a kill info message |
253 | my (@msg) = ($cb, @_); |
254 | my (@msg) = ($cb, @_); |
254 | $cb = sub { snd @msg, @_ }; |
255 | $cb = sub { snd @msg, @_ }; |
255 | } else { |
256 | } else { |