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