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