Ion/Util.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 29 CC 1 SCAR 6.9
CC
1
Cov
0%
gen
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Ion::Util;
2 # ABSTRACT: Helpers to make Ion more Util
3 $Ion::Util::VERSION = '0.07_01'; # TRIAL
4  
5 $Ion::Util::VERSION = '0.0701';use common::sense;
6 use Coro;
7  
8 use parent 'Exporter';
9  
10 our @EXPORT = qw(
11 gen
12 );
13  
14 sub gen (&) {
15 my $fn = shift;
16 my $in = Coro::Channel->new;
17 my $out = Coro::Channel->new;
18  
19 my $gen = async_pool{
20 my ($in, $out) = @_;
21 while (my $msg = $in->get) {
22 $out->put($fn->(@$msg));
23 }
24 } $in, $out;
25  
26 return sub{
27 $out->put(@_);
28 $in->get;
29 };
30 }
31  
32  
33 1;
34  
35 __END__