This example shows the usage of Stream::Coroutine.

You can only write to the stream with yielding.

Stream::Sub has the advantage that the stream object can be passed to other functions that in turn can write to the stream, which is not possible with coroutine streams.

On the other hand, Stream::Coroutine is more lightweight than Stream::Sub.



Creates a coroutine stream and dumps it.


This sub is a coroutine that is used as the source of the stream. It just writes the numbers 0 to 9 to the stream.


Jens Rieks <parrot at jensbeimsurfen dot de> is the author and maintainer. Please send patches and suggestions to the Perl 6 Internals mailing list.


Copyright (c) 2004, the Perl Foundation.