NAME
Reflexive::Role::StreamFiltering - Provides a composable behavior for Reflex::Streams to use POE::Filters
VERSION
version 1.103450
DESCRIPTION
Reflexive::Role::StreamFiltering provides a composable behavior that takes and uses a POE::Filter instance to filter inbound and outbound data similar to a POE::Wheel object. But this class is much much simpler. The goal is to merely shim in a POE::Filter instance and to do it as unobtrusively as possible. The same filter is used for both inbound and outbound filtering.
PUBLIC_ATTRIBUTES
input_filter
is: bare, isa: POE::Filter, default: POE::Filter::Stream
This attribute is mostly to be provided at construction of the Stream. If none is provided then POE::Filter::Stream (which is just a passthrough) is used.
Internally, the following handles are provided:
{
'filter_get' => 'get_one',
'filter_start' => 'get_one_start',
}
Incidentially, only the newer POE::Filter get_one_start/get_one interace is supported.
output_filter
is: bare, isa: POE::Filter, default: POE::Filter::Stream
Like the input_filter attribute, this is to be provided at construction time of the Stream. If an output_filter is not provided, POE::Filter::Stream is used.
The following handles are provided:
{
'filter_put' => 'put'
}
PUBLIC_METHODS
put
(Any)
This method is around advised to run the provided data through the fliter before passing it along to the original method if the filter returns multiple filtered chunks then each chunk will get its own method call.
PROTECTED_METHODS
on_data
(Dict[data => Any])
on_data is the advised to intercept data events. Data is passed through the ilter via get_one_start. Then get_one is called until no more filtered chunks are returned. Each filtered chunk is then delievered via the emitted data event which is reemitted.
AUTHOR
Nicholas R. Perez <nperez@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Nicholas R. Perez <nperez@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.