NAME
Flux::Simple - functional-style stream generators
VERSION
version 1.00
SYNOPSIS
use Flux::Simple qw( array_in array_out mapper );
my $mapper = mapper { shift() * 3 };
say $mapper->write(10); # 30
my $in = array_in([ 5,6,7 ]);
say $in->read; # 5
my @data;
my $out = array_out(\@data); # writes to $out will populate @data
FUNCTIONS
- array_in($arrayref)
-
Create an input stream which shifts items from a specified arrayref and returns them as values.
- array_out($arrayref)
-
Create an output stream which puts items into specified arrayref on writes.
- mapper($write_cb)
- mapper($write_cb, $flush_cb)
-
Create an anonymous mapper which calls
&write_cb
on each item.If
&flush_cb
is provided, it will be called at the commit step and its results will be used too (but remember that flushable mappers can't be attached to input streams).
AUTHOR
Vyacheslav Matyukhin <me@berekuk.ru>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Yandex LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.