| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::Codeowners::Formatter::JSON; | 
| 2 |  |  |  |  |  |  | # ABSTRACT: Format codeowners output as JSON | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 1 |  |  | 1 |  | 1065 | use warnings; | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 85 |  | 
| 6 | 1 |  |  | 1 |  | 12 | use strict; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 87 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | our $VERSION = '0.49'; # VERSION | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 1 |  |  | 1 |  | 16 | use parent 'App::Codeowners::Formatter'; | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 33 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 1 |  |  | 1 |  | 137 | use App::Codeowners::Util qw(zip); | 
|  | 1 |  |  |  |  | 10 |  | 
|  | 1 |  |  |  |  | 379 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub finish { | 
| 16 | 1 |  |  | 1 | 1 | 8 | my $self    = shift; | 
| 17 | 1 |  |  |  |  | 7 | my $results = shift; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 1 | 50 |  |  |  | 11 | eval { require JSON::MaybeXS } or die "Missing dependency: JSON::MaybeXS\n"; | 
|  | 1 |  |  |  |  | 19 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 1 |  |  |  |  | 8 | my %options; | 
| 22 | 1 | 50 |  |  |  | 21 | $options{pretty} = 1 if lc($self->format) eq 'pretty'; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 1 |  |  |  |  | 39 | my $json = JSON::MaybeXS->new(canonical => 1, %options); | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 1 |  |  |  |  | 71 | my $columns = $self->columns; | 
| 27 | 1 |  |  |  |  | 7 | $results = [map { +{zip @$columns, @$_} } @$results]; | 
|  | 3 |  |  |  |  | 20 |  | 
| 28 | 1 |  |  |  |  | 2 | print { $self->handle } $json->encode($results); | 
|  | 1 |  |  |  |  | 16 |  | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | 1; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | __END__ |