The use case seems to treat 0xfefefefe as a record separator. In this case, I would use POE::Filter::Line->new(Literal => "\xfe\xfe\xfe\xfe").

How do you guarantee you have a complete record without some kind of length prefix or terminator? Running out of octets in $data doesn't guarantee that it ended on a record boundary.

--
Rocco Caputo - [email protected]

On Mar 16, 2009, at 17:47, Craig Votava wrote:

Being lazy, I was hoping I could just define a different filter for POE::Wheel::FollowTail, that instead of being line oriented, would be record oriented (each record begins with 0xfefefefe).

I currently have a binary parser that can parse the data. Assuming the binary data is slurped up into the scalar "$data", the following code works great:

while($data) {
        # Find next beginning-of-record flag & extract record...
        $data =~ s/^[^\xfe]*(\xfe\xfe\xfe\xfe[^\xfe]+)// || die "No luck";
        my $event=$1;

        # Send record to parser...
        $parser->parse( $event );

        # Print restult...
        print "events DUMP:\n", Dumper($parser->{events}), "\n";
}

Being very new to POE and filters, is there something already existing that I could use? I've toyed with modifying one of the following:

POE::Filter::RecordBlock
POE::Filter::Regexp
POE::Filter::Block

Do any of these make sense for what I want to do? Should I punt on using FollowTail and try something else?

Any advice is appreciated!

Thanks

-Craig

Reply via email to