I tried the following
my $filter = POE::Filter::Line->new(OutputLiteral => '');
my $wheel = POE::Wheel::ReadWrite->new(
Handle => $socket,开发者_JAVA技巧
Filter => $filter,
InputEvent => 'on_input',
ErrorEvent => 'on_error',
FlushedEvent => 'on_flush',
);
But on_input is called several times with each line separately in ARG0. How do I get it all together? Doesn't setting setting OutputLiteral to '' change the filter's understanding of what a "line" is?
First of all, you are reading from the filter, so it's InputLiteral
which is important here, not OutputLiteral.
Second, you can't have an empty InputLiteral
(if you try, it will just autodetect the input literal). Consequently, you can't use POE::Filter::Line
to get all the data, because it is made for parsing line-terminated records. Use POE::Filter::Stream
instead.
精彩评论