Commit | Line | Data |
b63a955f |
1 | use strictures 1; |
2 | use Test::More; |
c6fe6fbd |
3 | use Sys::Hostname qw(hostname); |
b63a955f |
4 | |
5 | use Object::Remote::Connector::Local; |
6 | use Object::Remote; |
7 | |
8 | $ENV{PERL5LIB} = join( |
9 | ':', ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : ()), qw(lib t/lib) |
10 | ); |
11 | |
12 | my $connection = Object::Remote::Connector::Local->new->connect; |
13 | |
14 | #$Object::Remote::Connection::DEBUG = 1; |
15 | |
676438a1 |
16 | my $remote = Object::Remote->new( |
b63a955f |
17 | connection => $connection, |
18 | class => 'ORTestClass' |
676438a1 |
19 | ); |
b63a955f |
20 | |
676438a1 |
21 | isnt($$, $remote->pid, 'Different pid on the other side'); |
b63a955f |
22 | |
676438a1 |
23 | is($remote->counter, 0, 'Counter at 0'); |
b63a955f |
24 | |
676438a1 |
25 | is($remote->increment, 1, 'Increment to 1'); |
b63a955f |
26 | |
676438a1 |
27 | is($remote->counter, 1, 'Counter at 1'); |
b63a955f |
28 | |
fe6c9a7f |
29 | my $x = 0; |
30 | |
31 | is($remote->call_callback(27, sub { $x++ }), 27, "Callback ok"); |
32 | |
33 | is($x, 1, "Callback called callback"); |
34 | |
c6fe6fbd |
35 | is( |
36 | $connection->get_remote_sub('Sys::Hostname::hostname')->(), |
37 | hostname(), |
38 | 'Remote sub call ok' |
39 | ); |
40 | |
b63a955f |
41 | done_testing; |