INFORMATION ^

This example shows the usage of Stream::Filter.

Filter streams are used to alter and/or filter strings read from another stream. The strings are passed to a filter sub that will return the altered string, or null if the string should be filtered out.

FUNCTIONS ^

_main

Creates a counter stream that generates numbers from 0 to 9.

_counter

This sub is the source of the counter stream. It generates numbers from 0 to 9 in string form.

_filter

This sub is the source of the filter stream.

It doubles the read number and appends it together with " * 2 = " to the string. It also filters the value 4 out, which will be missing in the output.

AUTHOR ^

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 ^

Copyright (C) 2004-2008, The Perl Foundation.


parrot