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