Commit | Line | Data |
eee9a548 |
1 | package Object::Remote::Node; |
2 | |
3 | use strictures 1; |
4 | use Object::Remote::Connector::STDIO; |
07105aca |
5 | use Object::Remote::Logging qw(:log :dlog); |
eee9a548 |
6 | use Object::Remote; |
7 | use CPS::Future; |
8 | |
9 | sub run { |
07105aca |
10 | log_trace { "run() has been invoked on remote node" }; |
eee9a548 |
11 | my $c = Object::Remote::Connector::STDIO->new->connect; |
12 | |
13 | $c->register_class_call_handler; |
14 | |
eee9a548 |
15 | my $loop = Object::Remote->current_loop; |
16 | |
2d81cf18 |
17 | $c->on_close->on_ready(sub { |
18 | log_info { "Node connection with call handler has closed" }; |
19 | $loop->want_stop |
20 | }); |
eee9a548 |
21 | |
07105aca |
22 | Dlog_trace { "Node is sending 'Shere' to $_" } $c->send_to_fh; |
eee9a548 |
23 | print { $c->send_to_fh } "Shere\n"; |
24 | |
2d81cf18 |
25 | log_debug { "Node is going to start the run loop" }; |
eee9a548 |
26 | $loop->want_run; |
27 | $loop->run_while_wanted; |
2d81cf18 |
28 | log_debug { "Run loop invocation in node has completed" }; |
eee9a548 |
29 | } |
30 | |
31 | 1; |