Commit | Line | Data |
7462160e |
1 | use strictures 1; |
2 | use Test::More; |
3 | use Sys::Hostname qw(hostname); |
4 | |
abef6e5b |
5 | $ENV{OBJECT_REMOTE_TEST_LOGGER} = 1; |
f129bfaf |
6 | |
7462160e |
7 | use Object::Remote::FromData; |
8 | |
9 | my $connection = Object::Remote->connect('-'); |
10 | |
11 | my $remote = My::Data::TestClass->new::on($connection); |
12 | |
13 | is($remote->counter, 0, 'Counter at 0'); |
14 | |
15 | is($remote->increment, 1, 'Increment to 1'); |
16 | |
17 | is($remote->counter, 1, 'Counter at 1'); |
18 | |
19 | is( |
20 | My::Data::TestPackage->can::on($connection, 'hostname')->(), |
21 | hostname(), |
22 | 'Remote sub call ok' |
23 | ); |
24 | |
25 | done_testing; |
26 | |
27 | __DATA__ |
28 | package My::Data::TestClass; |
29 | |
30 | use Moo; |
31 | |
32 | has counter => (is => 'rwp', default => sub { 0 }); |
33 | |
34 | sub increment { $_[0]->_set_counter($_[0]->counter + 1); } |
35 | |
36 | package My::Data::TestPackage; |
37 | |
38 | use Sys::Hostname; |