NAME
Ryu::Source - base representation for a source of events
DESCRIPTION
This is probably the module you'd want to start with, if you were going to be using any of this. There's a disclaimer in Ryu that may be relevant at this point.
GLOBALS
$FUTURE_FACTORY
This is a coderef which should return a new Future-compatible instance.
Example overrides might include:
$Ryu::Source::FUTURE_FACTORY = sub { Mojo::Future->new->set_label(shift) };
METHODS
new
Takes named parameters.
chained
Returns a new Ryu::Source chained from this one.
describe
Returns a string describing this source and any parents - typically this will result in a chain like from->combine_latest->count
.
from
Creates a new source from things.
The precise details of what this method supports may be somewhat ill-defined at this point in time. It is expected that the interface and internals of this method will vary greatly in versions to come.
empty
Creates an empty source, which finishes immediately.
never
An empty source that never finishes.
throw
Throws something. I don't know what, maybe a chair.
METHODS - Instance
new_future
Used internally to get a Future.
pause
Does nothing useful.
resume
Is about as much use as "pause".
is_paused
Might return 1 or 0, but is generally meaningless.
debounce
Not yet implemented.
chomp
Chomps all items with the current delimiter.
Once you've instantiated this, it will stick with the delimiter which was in force at the time of instantiation. Said delimiter follows the usual rules of $/
, whatever they happen to be.
map
A bit like "map" in perlfunc.
combine_latest
merge
distinct
skip
skip_last
take
some
every
count
sum
mean
max
min
statistics
Emits a single hashref of statistics once the source completes.
filter
emit
flat_map
Similar to "map", but will flatten out some items:
an arrayref will be expanded out to emit the individual elements
for a Ryu::Source, passes on any emitted elements
This also means you can "merge" items from a series of sources.
Note that this is not recursive - an arrayref of arrayrefs will be expanded out into the child arrayrefs, but no further.
each
completed
METHODS - Proxied
The following methods are proxied to our completion Future:
then
is_ready
is_done
failure
is_cancelled
else
AUTHOR
Tom Molesworth <TEAM@cpan.org>
LICENSE
Copyright Tom Molesworth 2011-2016. Licensed under the same terms as Perl itself.