1POE::Filter::Line(3)  User Contributed Perl Documentation POE::Filter::Line(3)
2
3
4

NAME

6       POE::Filter::Line - filter data as lines
7

SYNOPSIS

9         $filter = POE::Filter::Line->new();
10         $arrayref_of_lines =
11           $filter->get($arrayref_of_raw_chunks_from_driver);
12         $arrayref_of_streamable_chunks_for_driver =
13           $filter->put($arrayref_of_lines);
14         $arrayref_of_leftovers =
15           $filter->get_pending();
16
17         # Use a literal newline terminator for input and output:
18         $filter = POE::Filter::Line->new( Literal => "\x0D\x0A" );
19
20         # Terminate input lines with a string regexp:
21         $filter = POE::Filter::Line->new( InputRegexp   => '[!:]',
22                                           OutputLiteral => "!"
23                                         );
24
25         # Terminate input lines with a compiled regexp (requires perl 5.005
26         # or newer):
27         $filter = POE::Filter::Line->new( InputRegexp   => qr/[!:]/,
28                                           OutputLiteral => "!"
29                                         );
30
31         # Autodetect the input line terminator:
32         $filter = POE::Filter::Line->new( InputLiteral => undef );
33

DESCRIPTION

35       The Line filter translates streams to and from separated lines.  The
36       lines it returns do not include the line separator (usually newlines).
37       Neither should the lines given to it.
38
39       Incoming newlines are recognized with a simple regular expression by
40       default: "/(\x0D\x0A?⎪\x0A\x0D?)/".  This regexp encompasses all the
41       variations of CR and/or LF, but it has a race condition.
42
43       Consider a CRLF newline is broken into two stream chunks, one which
44       ends with CR and the other which begins with LF:
45
46          some stream dataCR
47          LFother stream data
48
49       The default regexp will recognize the CR as one end-of-line marker and
50       the LF as another.  The line filter will emit two lines: "some stream
51       data" and a blank line.  People are advised to specify custom literal
52       newlines or autodetect the newline style in applications where blank
53       lines are significant.
54
55       Outgoing lines have traditional network newlines (CRLF) appended to
56       them by default.
57

PUBLIC FILTER METHODS

59       Please see POE::Filter.
60

SEE ALSO

62       POE::Filter.
63
64       The SEE ALSO section in POE contains a table of contents covering the
65       entire POE distribution.
66

BUGS

68       The default input newline regexp has a race condition where incomplete
69       newlines can generate spurious blank input lines.
70

AUTHORS & COPYRIGHTS

72       Please see POE for more information about authors and contributors.
73
74
75
76perl v5.8.8                       2006-09-01              POE::Filter::Line(3)
Impressum