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.29 by root, Tue Aug 4 23:16:57 2009 UTC vs.
Revision 1.30 by root, Tue Aug 4 23:35:51 2009 UTC

53 53
54=item port id - C<noderef#portname> 54=item port id - C<noderef#portname>
55 55
56A port id is normaly the concatenation of a noderef, a hash-mark (C<#>) as 56A port id is normaly the concatenation of a noderef, a hash-mark (C<#>) as
57separator, and a port name (a printable string of unspecified format). An 57separator, and a port name (a printable string of unspecified format). An
58exception is the the node port, whose ID is identical to it's node 58exception is the the node port, whose ID is identical to its node
59reference. 59reference.
60 60
61=item node 61=item node
62 62
63A node is a single process containing at least one port - the node 63A 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
244sub mon { 244sub 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 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines