Commit | Line | Data |
d3944ab9 |
1 | use strictures 1; |
2 | use Test::More; |
3 | |
abef6e5b |
4 | $ENV{OBJECT_REMOTE_TEST_LOGGER} = 1; |
5 | |
d3944ab9 |
6 | use Object::Remote; |
7 | use Object::Remote::FromData; |
8 | |
9 | my $conn1 = Reconnector->new::on('-'); |
10 | my $conn2 = $conn1->connect; |
11 | |
12 | isa_ok($conn1, 'Object::Remote::Proxy'); |
13 | isa_ok($conn2, 'Object::Remote::Proxy'); |
14 | |
15 | my $root_pid = $$; |
16 | my $conn1_pid = $conn1->pid; |
17 | my $conn2_pid = $conn2->pid; |
18 | |
19 | ok($root_pid != $conn1_pid, "Root and conn1 are not the same interpreter instance"); |
20 | ok($root_pid != $conn2_pid, "Root and conn2 are not the same interpreter instance"); |
21 | ok($conn1_pid != $conn2_pid, "conn1 and conn2 are not the same interpreter instance"); |
22 | |
23 | ok($conn1->ping eq "pong", "Ping success on conn1"); |
24 | ok($conn2->ping eq "pong", "Ping success on conn2"); |
25 | |
26 | done_testing; |
27 | |
28 | __DATA__ |
29 | |
30 | package Reconnector; |
31 | |
32 | use Moo; |
33 | |
34 | sub connect { |
35 | return Reconnector->new::on('-'); |
36 | } |
37 | |
38 | sub pid { |
39 | return $$; |
40 | } |
41 | |
42 | sub ping { |
43 | return 'pong'; |
abef6e5b |
44 | } |