5 use lib "$FindBin::Bin/lib";
6 require 't/logsetup.pl';
9 use Object::Remote::Future qw( await_all await_future );
14 my $_make_future_keep_proxy = sub {
15 # note: do not store the remote proxy somewhere
16 my $proxy = ORTestClass->new::on('-');
17 my $future = $proxy->start::call_callback(23, sub { sleep 1 });
22 my $_make_future = sub {
23 # note: do not store the remote proxy somewhere
24 my $future = ORTestClass
26 ->start::call_callback(23, sub { sleep 1 });
30 ['proxy kept', $_make_future_keep_proxy],
31 ['proxy thrown away', $_make_future],
34 for my $test (@tests) {
35 my ($title, $make) = @$test;
39 my $future = $make->();
40 local $SIG{ALRM} = sub { die "future timed out" };
43 my $result = await_future $future;
44 is $result, 23, 'correct value';
46 }, undef, 'no errors for await_future';
50 my $future = $make->();
51 local $SIG{ALRM} = sub { die "future timed out" };
54 my @result = await_all $future;
55 is $result[0], 23, 'correct value';
57 }, undef, 'no errors for await_all';