Commit | Line | Data |
499ebcdd |
1 | package System::Introspector::Report::Publish::StdOut; |
2 | use Moo; |
3 | use JSON::PP; |
4 | |
5 | has report => (is => 'ro'); |
6 | |
7 | my $_json = JSON::PP->new->utf8->pretty; |
8 | |
9 | sub 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 | |
24 | with $_ for qw( |
25 | System::Introspector::Report::Publish::API |
26 | ); |
27 | |
28 | 1; |