ES6/Event/IOAsync.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 26 CC 2 SCAR 12.0
CC
2
Cov
0%
__postpone
6.0
get_postpone
2.0
BEGIN
2.0
CRAP 3.3
1 package Promise::ES6::Event::IOAsync;
2  
3 use strict;
4 use warnings;
5  
6 #----------------------------------------------------------------------
7  
8 use Scalar::Util ();
9  
10 #----------------------------------------------------------------------
11  
12 our $_WEAK_LOOP;
13  
14 sub __postpone {
15 $_WEAK_LOOP ? $_WEAK_LOOP->later( $_[0] ) : die 'IO::Async::Loop object is gone!';
16 }
17  
18 sub get_postpone {
19 my $loop = shift or die 'Need IO::Async::Loop instance!';
20  
21 Scalar::Util::weaken( $_WEAK_LOOP = $loop );
22  
23 return \&__postpone;
24 }
25  
26 1;
27