开发者

How do I set up my POE::Filter to receive the entire chunk of data returned from the server?

开发者 https://www.devze.com 2023-03-14 21:59 出处:网络
I tried the following my $filter = POE::Filter::Line->new(OutputLiteral => \'\'); my $wheel = POE::Wheel::ReadWrite->new(

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号