]>
Dogcows Code - chaz/git-codeowners/blob - lib/App/Codeowners/Formatter/CSV.pm
1 package App
::Codeowners
::Formatter
::CSV
;
2 # ABSTRACT: Format codeowners output as comma-separated values
8 our $VERSION = '0.47'; # VERSION
10 use parent
'App::Codeowners::Formatter';
12 use App
::Codeowners
::Util
qw(stringify);
13 use Encode
qw(encode);
18 $self->text_csv->print($self->handle, $self->columns);
25 $self->text_csv->print($self->handle, [map { encode
('UTF-8', stringify
($_)) } @$result]);
32 $self->{text_csv
} ||= do {
33 eval { require Text
::CSV
} or die "Missing dependency: Text::CSV\n";
36 $options{escape_char
} = $self->escape_char if $self->escape_char;
37 $options{quote
} = $self->quote if $self->quote;
38 $options{sep
} = $self->sep if $self->sep;
39 if ($options{sep
} && $options{sep
} eq ($options{quote
} || '"')) {
40 die "Invalid separator value for CSV format.\n";
43 Text
::CSV-
>new({binary
=> 1, eol
=> $/, %options});
44 } or die "Failed to construct Text::CSV object";
48 sub sep
{ $_[0]->{sep
} || $_[0]->format }
49 sub quote
{ $_[0]->{quote
} }
50 sub escape_char
{ $_[0]->{escape_char
} }
62 App::Codeowners::Formatter::CSV - Format codeowners output as comma-separated values
70 This is a L<App::Codeowners::Formatter> that formats output using L<Text::CSV>.
76 Get the L<Text::CSV> instance.
80 Get the value used for L<Text::CSV/sep>.
84 Get the value used for L<Text::CSV/quote>.
88 Get the value used for L<Text::CSV/escape_char>.
92 Please report any bugs or feature requests on the bugtracker website
93 L<https://github.com/chazmcgarvey/git-codeowners/issues>
95 When submitting a bug or request, please include a test-file or a
96 patch to an existing test-file that illustrates the bug or desired
101 Charles McGarvey <chazmcgarvey@brokenzipper.com>
103 =head1 COPYRIGHT AND LICENSE
105 This software is copyright (c) 2019 by Charles McGarvey.
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
This page took 0.039432 seconds and 5 git commands to generate.