Hi all,

Just a quick question, mainly aimed at Schwern since he's most familiar with 
TAP::Harness, though others with thoughts should definitely chime in.

To handle streams, I am thinking of this:

  my $parser = TAPx::Parser->new;
  while ( defined ( my $chunk = $tap_stream->next ) ) {
      my @results = $parser->parse_chunk($chunk);
      # do what you will with the result objects
  }
  $parser->finalize;

This seems rather clean because it doesn't matter how the stream is created.  
Pass chunks (usually single lines, but it doesn't have to be) to the parser and 
everything is golden.  Also, this means that I am not dependent on the stream 
interface.

I assume it's desired to be able to view the results as they're coming in 
rather than wait for the end of the stream.

The only potential problem I see with the above scenario is that the chunks 
have to be "complete".  In other words, if I have a "got" in one chunk, having 
the "expected" in the next chunk makes it a bit more difficult to handle 
(though not insurmountable).  However, depending upon how buffering is handled, 
I could see this condition arising.

Thoughts?

Cheers,
Ovid
 
-- If this message is a response to a question on a mailing list, please send 
follow up questions to the list.
 
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/



Reply via email to