my $loop = IO::Async::Loop->new(); my $loop_guard = Promise::ES6::IOAsync::SET_LOOP($loop); # Now use Promise::ES6::IOAsync as you would plain Promise::ES6.
Whereas AnyEvent assumes that an event loop is global, IO::Async allows multiple concurrent event loops. In order to accommodate this difference in architecture, this module requires an active IO::Async::Loop object before it can be used. See
Sets this module’s active IO::Async::Loop object. This is a internal global; if you try to set a loop while one is already set, an exception is thrown.
This returns an opaque object that, when DESTROY()ed, will clear this module’s internal loop.