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