This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
cpan/Test-Simple - Update to version 1.302197
[perl5.git] / cpan / Test-Simple / lib / Test2 / Formatter.pm
index e95f24f..094bb00 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Formatter;
 use strict;
 use warnings;
 
-our $VERSION = '1.302103';
+our $VERSION = '1.302197';
 
 
 my %ADDED;
@@ -19,6 +19,8 @@ sub new_root {
     return $class->new(@_);
 }
 
+sub supports_tables { 0 }
+
 sub hide_buffered { 1 }
 
 sub terminate { }
@@ -61,6 +63,8 @@ A formatter is any package or object with a C<write($event, $num)> method.
 
     sub finalize { }
 
+    sub supports_tables { return $BOOL }
+
     sub new_root {
         my $class = shift;
         ...
@@ -92,11 +96,14 @@ The C<finalize> method is always the last thing called on the formatter, I<<
 except when C<terminate> is called for a Bail event >>. It is passed the
 following arguments:
 
-The C<new_root> method is called when C<Test2::API::Stack> Initializes the root
-hub for the first time. Most formatters will simply have this call C<<
-$class->new >>, which is the default behavior. Some formatters however may want
-to take extra action during construction of the root formatter, this is where
-they can do that.
+The C<supports_tables> method should be true if the formatter supports directly
+rendering table data from the C<info> facets. This is a newer feature and many
+older formatters may not support it. When not supported the formatter falls
+back to rendering C<detail> instead of the C<table> data.
+
+The C<new_root> method is used when constructing a root formatter. The default
+is to just delegate to the regular C<new()> method, most formatters can ignore
+this.
 
 =over 4
 
@@ -112,6 +119,12 @@ they can do that.
 
 =back
 
+The C<new_root> method is called when C<Test2::API::Stack> Initializes the root
+hub for the first time. Most formatters will simply have this call C<<
+$class->new >>, which is the default behavior. Some formatters however may want
+to take extra action during construction of the root formatter, this is where
+they can do that.
+
 =head1 SOURCE
 
 The source code repository for Test2 can be found at
@@ -135,7 +148,7 @@ F<http://github.com/Test-More/test-more/>.
 
 =head1 COPYRIGHT
 
-Copyright 2017 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>.
 
 This program is free software; you can redistribute it and/or
 modify it under the same terms as Perl itself.