ES6/Mojo.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 26 CC 2 SCAR 11.5
CC
2
Cov
0%
BEGIN
6.0
_postpone
2.0
BEGIN
2.0
CRAP 3.1
1 package Promise::ES6::Mojo;
2  
3 use strict;
4 use warnings;
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 Promise::ES6::Mojo - L<Promises/A+-compliant|https://github.com/promises-aplus/promises-spec> promises for L<Mojolicious>
11  
12 =head1 DEPRECATION NOTICE
13  
14 This module is deprecated and will go away eventually.
15 Use C<use_event()> instead, as described in L<Promise::ES6>’s documentation.
16  
17 =head1 DESCRIPTION
18  
19 This module exposes the same functionality as L<Promise::ES6::AnyEvent>
20 but for L<Mojo::IOLoop> rather than L<AnyEvent>.
21  
22 Its interface is almost compatible with the ES6-derived portions of
23 L<Mojo::Promise>, but note that Mojo::Promise’s C<all()> and
24 C<race()> methods accept a list of promises rather than an array reference.
25  
26 B<NOTE:> This module requires Mojolicious version 4.85 or higher.
27  
28 =cut
29  
30 #----------------------------------------------------------------------
31  
32 use parent qw( Promise::ES6::EventLoopBase );
33  
34 use Mojo::IOLoop ();
35  
36 BEGIN {
37 if (!Mojo::IOLoop->can('next_tick')) {
38 die( __PACKAGE__ . " requires Mojo::IOLoop::next_tick(). Upgrade to a newer Mojolicious version.$/" );
39 }
40 }
41  
42 #----------------------------------------------------------------------
43  
44 sub _postpone {
45 (undef, my $cb) = @_;
46  
47 Mojo::IOLoop->next_tick($cb);
48 }
49  
50 1;