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.81 by root, Mon Sep 7 18:33:44 2009 UTC vs.
Revision 1.82 by root, Mon Sep 7 18:42:09 2009 UTC

621the package, then the package above the package and so on (e.g. 621the package, then the package above the package and so on (e.g.
622C<MyApp::Chat::Server>, C<MyApp::Chat>, C<MyApp>) until the function 622C<MyApp::Chat::Server>, C<MyApp::Chat>, C<MyApp>) until the function
623exists or it runs out of package names. 623exists or it runs out of package names.
624 624
625The init function is then called with the newly-created port as context 625The init function is then called with the newly-created port as context
626object (C<$SELF>) and the C<@initdata> values as arguments. 626object (C<$SELF>) and the C<@initdata> values as arguments. It I<must>
627call one of the C<rcv> functions to set callbacks on C<$SELF>, otherwise
628the port might not get created.
627 629
628A common idiom is to pass a local port, immediately monitor the spawned 630A common idiom is to pass a local port, immediately monitor the spawned
629port, and in the remote init function, immediately monitor the passed 631port, and in the remote init function, immediately monitor the passed
630local port. This two-way monitoring ensures that both ports get cleaned up 632local port. This two-way monitoring ensures that both ports get cleaned up
631when there is a problem. 633when there is a problem.
655 657
656sub _spawn { 658sub _spawn {
657 my $port = shift; 659 my $port = shift;
658 my $init = shift; 660 my $init = shift;
659 661
662 # rcv will create the actual port
660 local $SELF = "$NODE#$port"; 663 local $SELF = "$NODE#$port";
661 eval { 664 eval {
662 &{ load_func $init } 665 &{ load_func $init }
663 }; 666 };
664 _self_die if $@; 667 _self_die if $@;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines