On 10 Jun 2008, at 08:14, Ovid wrote:
So I wonder if there are other ways. E.g. if the harness could catch
the warnings?

The harness has code which can allow you to merge the STDERR and STDOUT
streams.  See the '--merge' switch to prove.  With that, a
(simple-minded) parser becomes:

   use TAP::Parser;

   my $parser = TAP::Parser->new( {
       source => $source,
       merge  => 1,
   } );

   while ( my $result = $parser->next ) {
       if ( $result->is_unknown ) {
          # it's a warning or the code printed something to STDOUT
       }
   }

That's not enough for what you want, but is that a start?


I wonder if TAP::Filter[1] would help with that? I think you could use it to write a filter that converted warnings into additional errors.

# In a filter
sub inspect {
    my ($self, $result) = @_;
    if ( $result->is_unknown ) {
        return $self->ok(description => 'Unknown TAP token', ok => 0);
    }
    return $result;
}


[1] http://search.cpan.org/dist/TAP-Filter

--
Andy Armstrong, Hexten




Reply via email to