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