]>
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
6 This is a L<App::Codeowners::Formatter> that formats output using L<Text::CSV>.
13 our $VERSION = '9999.999'; # VERSION
15 use parent
'App::Codeowners::Formatter';
17 use App
::Codeowners
::Util
qw(stringify);
18 use Encode
qw(encode);
23 $self->text_csv->print($self->handle, $self->columns);
30 $self->text_csv->print($self->handle, [map { encode
('UTF-8', stringify
($_)) } @$result]);
35 Get the L
<Text
::CSV
> instance
.
42 $self->{text_csv
} ||= do {
43 eval { require Text
::CSV
} or die "Missing dependency: Text::CSV\n";
46 $options{escape_char
} = $self->escape_char if $self->escape_char;
47 $options{quote
} = $self->quote if $self->quote;
48 $options{sep
} = $self->sep if $self->sep;
49 if ($options{sep
} && $options{sep
} eq ($options{quote
} || '"')) {
50 die "Invalid separator value for CSV format.\n";
53 Text
::CSV-
>new({binary
=> 1, eol
=> $/, %options});
54 } or die "Failed to construct Text::CSV object";
59 Get the value used
for L
<Text
::CSV
/sep
>.
63 Get the value used
for L
<Text
::CSV
/quote
>.
67 Get the value used
for L
<Text
::CSV
/escape_char
>.
71 sub sep
{ $_[0]->{sep
} || $_[0]->format }
72 sub quote
{ $_[0]->{quote
} }
73 sub escape_char
{ $_[0]->{escape_char
} }
This page took 0.04599 seconds and 4 git commands to generate.