… | |
… | |
398 | |
398 | |
399 | =cut |
399 | =cut |
400 | |
400 | |
401 | sub rcv($@); |
401 | sub rcv($@); |
402 | |
402 | |
403 | sub _kilme { |
403 | my $KILME = sub { |
404 | die "received message on port without callback"; |
404 | die "received message on port without callback"; |
405 | } |
405 | }; |
406 | |
406 | |
407 | sub port(;&) { |
407 | sub port(;&) { |
408 | my $id = $UNIQ . ++$ID; |
408 | my $id = $UNIQ . ++$ID; |
409 | my $port = "$NODE#$id"; |
409 | my $port = "$NODE#$id"; |
410 | |
410 | |
411 | rcv $port, shift || \&_kilme; |
411 | rcv $port, shift || $KILME; |
412 | |
412 | |
413 | $port |
413 | $port |
414 | } |
414 | } |
415 | |
415 | |
416 | =item rcv $local_port, $callback->(@msg) |
416 | =item rcv $local_port, $callback->(@msg) |
… | |
… | |
991 | or or is deleted the callback is called with a hash containing the |
991 | or or is deleted the callback is called with a hash containing the |
992 | database family and three lists of added, changed and deleted subkeys, |
992 | database family and three lists of added, changed and deleted subkeys, |
993 | respectively. If no keys have changed then the array reference might be |
993 | respectively. If no keys have changed then the array reference might be |
994 | C<undef> or even missing. |
994 | C<undef> or even missing. |
995 | |
995 | |
|
|
996 | If not called in void context, a guard object is returned that, when |
|
|
997 | destroyed, stops the monitor. |
|
|
998 | |
996 | The family hash reference and the key arrays belong to AnyEvent::MP and |
999 | The family hash reference and the key arrays belong to AnyEvent::MP and |
997 | B<must not be modified or stored> by the callback. When in doubt, make a |
1000 | B<must not be modified or stored> by the callback. When in doubt, make a |
998 | copy. |
1001 | copy. |
999 | |
1002 | |
1000 | As soon as possible after the monitoring starts, the callback will be |
1003 | As soon as possible after the monitoring starts, the callback will be |