POE::Filter::Stackable - POE Multiple Filter Abstraction |
POE::Filter::Stackable - POE Multiple Filter Abstraction
$filter = new POE::Filter::Stackable(Filters => [ $filter1, $filter2 ]); $filter = new POE::Filter::Stackable; $filter->push($filter1, $filter2); $filter2 = $filter->pop; $filter1 = $filter->shift; $filter->unshift($filter1, $filter2); $arrayref_for_driver = $filter->put($arrayref_of_data); $arrayref_for_driver = $filter->put($single_data_element); $arrayref_of_data = $filter->get($arrayref_of_raw_data); $arrayref_of_leftovers = $filter->get_pending; @filter_type_names = $filter->filter_types; @filter_objects = $filter->filters;
The Stackable filter allows the use of multiple filters within a single wheel. Internally, filters are stored in an array, with array index 0 being ``near'' to the wheel's handle and therefore being the first filter passed through using ``get'' and the last filter passed through in ``put''. All POE::Filter public methods are implemented as though data were being passed through a single filter; other program components do not need to know there are multiple filters.
new()
method creates the Stackable filter. It accepts an optional
parameter ``Filters'' that specifies an arrayref of initial filters. If
no filters are given, Stackable will pass data through unchanged; this
is true if there are no filters present at any time.
These methods all function identically to the perl builtin functions
of the same name. push()
and unshift()
will return the new number of
filters inside the Stackable filter.
filter_types()
method returns a list of types for the filters
inside the Stackable filter, in order from near to far; for example,
qw(Block HTTPD).
filters()
method returns a list of the objects inside the
Stackable filter, in order from near to far.
POE::Filter; POE::Filter::HTTPD; POE::Filter::Reference; POE::Filter::Line; POE::Filter::Block; POE::Filter::Stream
Undoubtedly. None currently known.
The Stackable filter was contributed by Dieter Pearcey. Rocco Caputo is sure to have had his hands in it.
Please see the POE manpage for more information about authors and contributors.
POE::Filter::Stackable - POE Multiple Filter Abstraction |