Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

poe::filter::recordblock(3pm) [debian man page]

POE::Filter::RecordBlock(3pm)				User Contributed Perl Documentation			     POE::Filter::RecordBlock(3pm)

NAME
POE::Filter::RecordBlock - translate between discrete records and blocks of them SYNOPSIS
Hello, dear reader. This SYNOPSIS does not contain a fully functioning sample program because your humble documenter cannot come up with a short, reasonable use case for this module. Please contact the maintainer if this module is useful to you. Otherwise you may wake up one morning to discover that it has been deprecated. $filter = new POE::Filter::RecordBlock( BlockSize => 4 ); $arrayref_of_arrayrefs = $filter->get($arrayref_of_raw_data); $arrayref_of_raw_chunks = $filter->put($arrayref_of_arrayrefs); $arrayref_of_raw_chunks = $filter->put($single_arrayref); $arrayref_of_leftovers = $filter->get_pending; $arrayref_of_leftovers = $filter->put_pending; DESCRIPTION
On input, POE::Filter::RecordBlock translates a stream of discrete items into a "block" of them. It does this by collecting items until it has BlockSize of them, then returning the lot of them in an array reference. On output, this module flattens array references. This module may be deprecated in the future. Please contact the maintainer if this module is useful to you. PUBLIC FILTER METHODS
In addition to the usual POE::Filter methods, POE::Filter::RecordBlock supports the following. new new() takes at least one mandatory argument, BlockSize, which must be defined and greater than zero. new() also accepts a CheckPut Boolean parameter that indicates whether put() should check for the proper BlockSize before allowing data to be serialized. Using CheckPut is not recommended, as it enables a write buffer in the filter, therefore breaking put() for normal use. put_pending put_pending() returns an arrayref of any records that are waiting to be sent. It is the outbound equivalent of POE::Filter's get_pending() accessor. put_pending() is not part of the canonical POE::Filter API, so nothing will use it. It's up to applications to handle pending output, whenever it's appropriate to do so. blocksize blocksize() is an accessor/mutator for POE::Filter::RecordBlock's BlockSize value. checkput checkput() is an accessor/mutator for POE::Filter::RecordBlock's CheckPut flag. SEE ALSO
POE::Filter for more information about filters in general. POE::Filter::Stackable for more details on stacking filters. BUGS
This filter may maintain an output buffer that no other part of POE will know about. This filter implements a highly specialized and seemingly not generally useful feature. Does anyone use this filter? This filter may be deprecated if nobody speaks up. AUTHORS &; COPYRIGHTS The RecordBlock filter was contributed by Dieter Pearcey. Documentation is provided by Rocco Caputo. Please see the POE manpage for more information about authors and contributors. perl v5.14.2 2012-05-15 POE::Filter::RecordBlock(3pm)

Check Out this Related Man Page

POE::Filter::Map(3pm)					User Contributed Perl Documentation				     POE::Filter::Map(3pm)

NAME
POE::Filter::Map - transform input and/or output within a filter stack SYNOPSIS
#!perl use POE qw( Wheel::FollowTail Filter::Line Filter::Map Filter::Stackable ); POE::Session->create( inline_states => { _start => sub { my $parse_input_as_lines = POE::Filter::Line->new(); my $redact_some_lines = POE::Filter::Map->new( Code => sub { my $input = shift; $input = "[REDACTED]" unless $input =~ /sudo[d+]/i; return $input; }, ); my $filter_stack = POE::Filter::Stackable->new( Filters => [ $parse_input_as_lines, # first on get, last on put $redact_some_lines, # first on put, last on get ] ); $_[HEAP]{tailor} = POE::Wheel::FollowTail->new( Filename => "/var/log/system.log", InputEvent => "got_log_line", Filter => $filter_stack, ); }, got_log_line => sub { print "Log: $_[ARG0] "; } } ); POE::Kernel->run(); exit; DESCRIPTION
POE::Filter::Map transforms data inside the filter stack. It may be used to transform input, output, or both depending on how it is constructed. This filter is named and modeled after Perl's built-in map() function. POE::Filter::Map is designed to be combined with other filters through POE::Filter::Stackable. In the "SYNOPSIS" example, a filter stack is created to parse logs as lines and redact all entries that don't pertain to a sudo process. PUBLIC FILTER METHODS
In addition to the usual POE::Filter methods, POE::Filter::Map also supports the following. new new() constructs a new POE::Filter::Map object. It must either be called with a single Code parameter, or both a Put and a Get parameter. The values for Code, Put and Get are code references that, when invoked, return transformed versions of their sole parameters. A Code function will be used for both input and output, while Get and Put functions allow input and output to be filtered in different ways. # Decrypt rot13. sub decrypt_rot13 { my $encrypted = shift; $encrypted =~ tr[a-zA-Z][n-za-mN-ZA-M]; return $encrypted; } # Encrypt rot13. sub encrypt_rot13 { my $plaintext = shift; $plaintext =~ tr[a-zA-Z][n-za-mN-ZA-M]; return $plaintext; } # Decrypt rot13 on input, and encrypt it on output. my $rot13_transcrypter = POE::Filter::Map->new( Get => &decrypt_rot13, Put => &encrypt_rot13, ); Rot13 is symmetric, so the above example can be simplified to use a single Code function. my $rot13_transcrypter = POE::Filter::Map->new( Code => sub { local $_ = shift; tr[a-zA-Z][n-za-mN-ZA-M]; return $_; } ); modify modify() changes a POE::Filter::Map object's behavior at run-time. It accepts the same parameters as new(), and it replaces the existing transforms with new ones. # Switch to "reverse" encryption for testing. $rot13_transcrypter->modify( Code => sub { return scalar reverse shift } ); SEE ALSO
POE::Filter for more information about filters in general. POE::Filter::Stackable for more details on stacking filters. BUGS
None known. AUTHORS &; COPYRIGHTS The Map filter was contributed by Dieter Pearcey. Documentation is provided by Rocco Caputo. Please see the POE manpage for more information about authors and contributors. perl v5.14.2 2012-05-15 POE::Filter::Map(3pm)
Man Page