| 1 | package Promise::ES6::AnyEvent; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use parent qw(Promise::ES6::EventLoopBase); | ||
| 7 | |||
| 8 | =encoding utf-8 | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Promise::ES6::AnyEvent - L<Promises/A+-compliant|https://github.com/promises-aplus/promises-spec> promises | ||
| 13 | |||
| 14 | =head1 DEPRECATION NOTICE | ||
| 15 | |||
| 16 | This module is deprecated and will go away eventually. | ||
| 17 | Use C<use_event()> instead, as described in L<Promise::ES6>’s documentation. | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | This subclass of L<Promise::ES6> incorporates L<AnyEvent> in order to | ||
| 22 | implement full Promises/A+ compliance. Specifically, this class defers | ||
| 23 | execution of resolve and reject callbacks to the end of the current event | ||
| 24 | loop iteration. | ||
| 25 | |||
| 26 | =head1 SEE ALSO | ||
| 27 | |||
| 28 | This distribution includes L<Promise::ES6::IOAsync> for those who | ||
| 29 | prefer L<IO::Async>. | ||
| 30 | |||
| 31 | CPAN’s L<Promises>, L<AnyEvent::Promises>, and L<AnyEvent::XSPromises> | ||
| 32 | all provide functionality similar to this class’s. | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | #---------------------------------------------------------------------- | ||
| 37 | |||
| 38 | use AnyEvent (); | ||
| 39 | |||
| 40 | #---------------------------------------------------------------------- | ||
| 41 | |||
| 42 | sub _postpone { | ||
| 43 | |||
| 44 | # postpone()’s prototype needlessly rejects a plain scalar. | ||
| 45 | return &AnyEvent::postpone( $_[1] ); | ||
| 46 | } | ||
| 47 | |||
| 48 | 1; |