Hi all,

I've just released TAPx::Parser 0.20 and it should be hitting the CPAN soon.  
From the Changes file:

0.20     2 September 2006
         - Fixed bug reported by GEOFFR.  When no tap output was found, an
           "Unitialized value" warning occurred.
         - Updated tprove to now report a test failure when no tap output
           found.
         - Removed examples/tprove_color2 as tprove_color now works.
         - Vastly improved callback system and updated the docs for how to use
           them.
         - Changed TAPx::Parser::Source::Perl to use Symbol::gensym() instead
           of a hard-to-guess filehandle name.

Note that tprove_color works just find and produces incredibly hideous output.  
However, it does show how the callback system works.  Further, though I don't 
know Tk or other windowing systems well enough, it should now be fairly easy to 
slap a GUI on TAPx::Parser.
 
Also, the callback system previously required that you provide a callback for 
every result type lest it be ignored.  Now there are two new types of 
callbacks, "ELSE" and "ALL".  ELSE will be triggered if a callback for a 
specific result type is not found.  ALL will be triggered for all result types 
and is guaranteed to be triggered for each result after other callbacks, if 
any, are triggered.  For example, if you're using Term::ANSIColor, the 
following callbacks make colored test output easy:

 my %callbacks = (
     test => sub {
         my $test = shift;
         if ( $test->passed && not $test->directive ) {
             # normal passing test
             print color 'green';
         }
         elsif ( !$test->passed ) {    # even if it's TODO
             print color 'white on_red';
         }
         elsif ( $test->has_skip ) {
             print color 'white on_blue';
         }
         elsif ( $test->has_todo ) {
             print color 'white';
         }
     },
     ELSE => sub {
         # plan, comment, and so on (anything which isn't a test line)
         print color 'black on_white';
     },
     ALL => sub {
         # now print them
         print shift->as_string;
         print color 'reset';
         print "\n";
     },
 );

See examples/tprove_color for more information.

Cheers,
Ovid

-- 
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/



Reply via email to