This example demonstrates how to include another stream inside a stream.
- _main
- Creates a counter stream and dumps it.
- _counter
- This sub is used as the source for the counter stream.
- It writes the numbers 0 to 9 as strings to the stream.
- After writing "4",
it will create another stream (with the sub
_included
as source) and then includes it in its own stream.
- _included
- This sub is the source of the stream included into the counter stream.
- It writes "hello",
then includes another stream (
_counter2
) and then writes "world".
- _counter2
- This sub is the source of the stream included between the "hello" and the "world".
- Writes the letters "A" till "F" into 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.