John Christian wrote:

I'm wondering, what's the best way in POE to handle a multi-line protocol, essentially I have input that looks like this, which is handled in my code by a ReadWrite session spawned from a Wheel::SocketFactory connection:

CMD- arg1 arg2 ...
  ... arbitrary number of lines here ...
CMD END

I suggest writing your own private filter for separating each command in the protocol, based on the vauge example provided. Since some of the filters do thier splitting based on regular expressions theoretically you could use this, such as POE::Filter::Line.

POE::Filter::Line->new(InputLiteral => "END\n");

This is of course assuming END\n will NEVER occur in your "arbitrary number of lines here" segment.

But again, it would definitely be most accurate to write your own filter.

- Scott

Reply via email to