got all general logging done, start of adding ids to objects and incorporating ids...
[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 :dlog);
6 use Object::Remote;
7 use CPS::Future;
8
9 sub run {
10   log_trace { "run() has been invoked on remote node" };
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   Dlog_trace { "Node is sending 'Shere' to $_" } $c->send_to_fh;
23   print { $c->send_to_fh } "Shere\n";
24
25   log_debug { "Node is going to start the run loop" };
26   $loop->want_run;
27   $loop->run_while_wanted;
28   log_debug { "Run loop invocation in node has completed" };
29 }
30
31 1;