File Coverage

blib/lib/Async/Trampoline.pm
Criterion Covered Total %
statement 108 123 87.8
branch 8 8 100.0
condition n/a
subroutine 26 42 61.9
pod 1 1 100.0
total 143 174 82.1


line stmt bran cond sub pod time code
1 5     4   188216 use strict;
  5         477  
  5         129  
2 5     4   28 use warnings;
  5         16  
  4         111  
3 4     4   327 use utf8;
  5         24  
  5         31  
4              
5             package Async::Trampoline;
6              
7             BEGIN {
8             ## no critic
9 5     4   228 our $VERSION = '0.001002'; # VERSION
10 5         449 $VERSION = eval $VERSION;
11             ## use critic
12             }
13              
14 4     4   23 use XSLoader;
  5         11  
  5         120  
15 5     4   7232 BEGIN { XSLoader::load __PACKAGE__, our $VERSION }
16              
17 5     4   1183 use Async::Trampoline::Scheduler;
  4         10  
  4         123  
18              
19 5     4   33 use Exporter 'import';
  4         8  
  4         465  
20              
21             our %EXPORT_TAGS = (
22             all => [qw/
23             await
24             async
25             async_value
26             async_error
27             async_cancel
28             async_yield
29             /],
30             );
31              
32             our @EXPORT_OK = @{ $EXPORT_TAGS{all} };
33              
34             use overload
35             fallback => 1,
36             q("") => sub {
37 4     4   962654 my ($self) = @_;
38 4         29 return $self->to_string;
39 5     4   3178 };
  5         2993  
  5         38  
40              
41             sub gen_collect :method {
42 10     8 1 6263 my ($gen) = @_;
43 10         20 my @acc;
44             return $gen
45 78     77   1067 ->gen_foreach(sub { push @acc, @_; return async_value })
  77         400  
46 9         2708 ->value_then(async_value \@acc);
47             }
48              
49             1;
50              
51             __END__