| Devel-CoverReport documentation | Contained in the Devel-CoverReport distribution. |
Store Devel::CoverReport reports as YAML data dumps - readable by both: humans, and machines.
Consider this module to be an early ALPHA. It does the job for me, so it's here.
This is my first CPAN module, so I expect that some things may be a bit rough around edges.
The plan is, to fix both those issues, and remove this warning in next immediate release.
See: Devel::CoverReport::Formatter.
Copyright 2009-2010, Bartłomiej Syguła (natanael@natanael.krakow.pl)
This is free software. It is licensed, and can be distributed under the same terms as Perl itself.
For more, see my website: http://natanael.krakow.pl/
| Devel-CoverReport documentation | Contained in the Devel-CoverReport distribution. |
# Copyright 2009-2010, BartÅomiej SyguÅa (natanael@natanael.krakow.pl) # # This is free software. It is licensed, and can be distributed under the same terms as Perl itself. # # For more, see my website: http://natanael.krakow.pl/ package Devel::CoverReport::Formatter::YAML; use strict; use warnings; our $VERSION = "0.03"; use base 'Devel::CoverReport::Formatter'; use Carp::Assert::More qw( assert_defined ); use English qw( -no_match_vars ); use Params::Validate qw( :all ); use YAML::Syck 1.05 qw( DumpFile );
sub process_report_start { # {{{ my ( $self, $report ) = @_; $self->{'Instance'}->{'metadata'} = { title => $report->{'title'}, version => $VERSION, }; return; } # }}} sub process_table_start { # {{{ my ( $self, $report, $table ) = @_; my %current_table = ( label => $table->{'label'}, rows => [], summary => [], headers => $table->get_headers(), headers_order => $table->get_headers_order(), ); # Open the table: push @{ $self->{'Instance'}->{'data'}->{'tables'} }, \%current_table; $self->{'Instance'}->{'current_table'} = \%current_table; return; } # }}} sub process_row { # {{{ my ( $self, $report, $table, $row ) = @_; $self->_process_in_row($report, $table, $row, 'rows'); return; } # }}} sub process_summary { # {{{ my ( $self, $report, $table, $summary ) = @_; $self->_process_in_row($report, $table, $summary, 'summary'); return; } # }}} sub _process_in_row { # {{{ my ( $self, $report, $table, $row, $_target ) = @_; push @{ $self->{'Instance'}->{'current_table'}->{$_target} }, $row; return; } # }}} sub process_report_end { # {{{ my ( $self, $report ) = @_; assert_defined($self->{'basedir'}, 'Missing basedir!'); assert_defined($report->{'basename'}, 'Missing basename!'); my $report_filename = $self->{'basedir'} . q{/} . $report->{'basename'} . q{.yml}; DumpFile($report_filename, { metadata=>$self->{'Instance'}->{'metadata'}, data=>$self->{'Instance'}->{'data'} }); $self->{'Instance'} = undef; return $report_filename; } # }}} 1;
# vim: fdm=marker