found location of hang; make annotations; added more log lines
[scpubgit/Object-Remote.git] / lib / Object / Remote / Node.pm
1 package Object::Remote::Node;
2
3 use strictures 1;
4 use Object::Remote::Connector::STDIO;
5 use Object::Remote::Logging qw(:log);
6 use Object::Remote;
7 use CPS::Future;
8
9 sub run {
10   log_trace { "run() has been invoked on remote node; creating STDIO connector" };
11   my $c = Object::Remote::Connector::STDIO->new->connect;
12
13   $c->register_class_call_handler;
14
15   my $loop = Object::Remote->current_loop;
16
17   $c->on_close->on_ready(sub { 
18     log_info { "Node connection with call handler has closed" };
19     $loop->want_stop 
20   });
21
22   print { $c->send_to_fh } "Shere\n";
23
24   log_debug { "Node is going to start the run loop" };
25   $loop->want_run;
26   $loop->run_while_wanted;
27   log_debug { "Run loop invocation in node has completed" };
28 }
29
30 1;