give modules default loggers so they are usable on their own (in tests)
[scpubgit/System-Introspector-Report.git] / lib / System / Introspector / Report / Publish / StdOut.pm
CommitLineData
499ebcdd 1package System::Introspector::Report::Publish::StdOut;
2use Moo;
3use JSON::PP;
4
5has report => (is => 'ro');
6
7my $_json = JSON::PP->new->utf8->pretty;
8
9sub publish {
10 my ($self, $reports) = @_;
11 my $match = $self->report;
12 return unless defined $match;
13 $match = $self->_prepare_matcher_from($match);
14 for my $idx (0 .. $#$reports) {
15 my $report = $reports->[$idx];
16 next unless $self->_match_id($report, $match);
17 print $_json->encode($report), "\n";
18 print "---\n"
19 if $idx < $#$reports;
20 }
21 return 1;
22}
23
24with $_ for qw(
25 System::Introspector::Report::Publish::API
26);
27
281;