The following documentation is automatically generated. Please do not edit this file, but rather the original, inline with Ryu::Async at lib/Ryu/ (on the system that originally ran this). If you do edit this file, and don't want your changes to be removed, make sure you change the first line.


Ryu::Async - use Ryu with IO::Async


 #!/usr/bin/env perl
 use strict;
 use warnings;
 use IO::Async::Loop;
 use Ryu::Async;
 # This will generate a lot of output, but is useful
 # for demonstrating lifecycles. Drop this to 'info' or
 # 'debug' to make it more realistic.
 use Log::Any::Adapter qw(Stdout), log_level => 'trace';
 my $loop = IO::Async::Loop->new;
        my $ryu = Ryu::Async->new
        my $timer = $ryu->timer(
                interval => 0.10,
         ->each(sub { print "tick\n" });
        warn $timer->describe;


This is an IO::Async::Notifier subclass for interacting with Ryu.



Creates a new Ryu::Source from a thing.

The exact details of this are likely to change in future, but a few things that are expected to work:

     ->each(sub { print "Line: $_\n" });
     ->each(sub { print "Total was $_\n" });


Create a new Ryu::Source from an IO::Async::Stream instance.

Note that a stream which is not already attached to an IO::Async::Notifier will be added as a child of this instance.


Create a new Ryu::Source that wraps STDIN.

As with other IO::Async::Stream wrappers, this will emit data as soon as it's available, as raw bytes.

Use "by_line" in Ryu::Source and "decode" in Ryu::Source to split into lines and/or decode from UTF-8.


Returns a new Ryu::Sink that wraps STDOUT.


Provides a Ryu::Source which emits an empty string at selected intervals.

Takes the following named parameters:

  • interval - how often to trigger the timer, in seconds (fractional values allowed)

  • reschedule - type of rescheduling to use, can be soft, hard or drift as documented in IO::Async::Timer::Periodic


 $ryu->timer(interval => 1, reschedule => 'hard')


Creates an IO::Async::Process.


Returns a new Ryu::Source instance.


Creates a new UDP client.

This provides a sink for "outgoing" in Ryu::Async::Client packets, and a source for "incoming" in Ryu::Async::Client responses.

  • uri - an optional URI of the form udp://host:port

  • host - which host to listen on, defaults to

  • port - the port to listen on

Returns a Ryu::Async::Client instance.



Creates a listening TCP socket, and provides a Ryu::Async::Server instance which will emit a new event every time a client connects.


Returns a new Ryu::Sink.

The label will default to the calling package/class and method, with some truncation rules:

  • A Net::Async:: prefix will be replaced by Na.

  • A Web::Async:: prefix will be replaced by Wa.

  • A Database::Async:: prefix will be replaced by Da.

  • A IO::Async:: prefix will be replaced by Ia.

  • A Tickit::Async:: prefix will be replaced by Ta.

  • A Tickit::Widget:: prefix will be replaced by TW.

This list of truncations is subject to change, so please don't rely on any of these in string matches or similar - better to set your own label if you need consistency.




add_child, adopt_future, adopted_futures, can_event, children, configure, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent


Tom Molesworth <>


Copyright Tom Molesworth 2011-2019. Licensed under the same terms as Perl itself.