use strictures 1;
use Test::More;
+use Object::Remote;
+use File::Spec;
{
package S1S;
sub get_s2 {
future {
my $f = shift;
- $C = sub { $f->done(S2F->new); undef($f); };
+ $C = sub { $f->done(S2F->new); undef($f); undef($C); };
$f;
}
}
sub get_s3 {
future {
my $f = shift;
- $C = sub { $f->done('S3'); undef($f); };
+ $C = sub { $f->done('S3'); undef($f); undef($C); };
$f;
}
}
is($res, 'S3', 'Asynchronous code ok');
+is(S1S->get_s2->get_s3, 'S3', 'Sync without start');
+
+open my $fh, '<', File::Spec->devnull;
+
+Object::Remote->current_loop->watch_io(
+ handle => $fh,
+ on_read_ready => sub {
+ $S1F::C->() if defined $S1F::C;
+ $S2F::C->() if defined $S2F::C;
+ }
+);
+
+is(S1F->get_s2->get_s3, 'S3', 'Async without start');
+
done_testing;