POE::Wheel::FollowTail to read binary records!?!

Craig Votava <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
Folks-

In my environment there exists an application that creates a raw ascii  
data file on a given host in real time. I wanted to take this raw data  
and put it up in a GUI analysis window, so I wrote a POE-based Perl-Tk  
script, which uses POE::Wheel::FollowTail (Thanks Rocco, et. al.) as  
the data feed and uses Perl-Tk as the GUI. This works very well.

Now, the application has a "-binary" option, which will create a raw  
binary file on a given host in real time. I want my GUI analysis  
program to be able to work with this data as well. What should I do?

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.