]>
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);
22 $self->text_csv->print($self->handle, $self->columns);
29 $self->text_csv->print($self->handle, [map { stringify
($_) } @$result]);
34 Get the L
<Text
::CSV
> instance
.
41 $self->{text_csv
} ||= do {
42 eval { require Text
::CSV
} or die "Missing dependency: Text::CSV\n";
45 $options{escape_char
} = $self->escape_char if $self->escape_char;
46 $options{quote
} = $self->quote if $self->quote;
47 $options{sep
} = $self->sep if $self->sep;
48 if ($options{sep
} && $options{sep
} eq ($options{quote
} || '"')) {
49 die "Invalid separator value for CSV format.\n";
52 Text
::CSV-
>new({binary
=> 1, eol
=> $/, %options});
53 } or die "Failed to construct Text::CSV object";
58 Get the value used
for L
<Text
::CSV
/sep
>.
62 Get the value used
for L
<Text
::CSV
/quote
>.
66 Get the value used
for L
<Text
::CSV
/escape_char
>.
70 sub sep
{ $_[0]->{sep
} || $_[0]->format }
71 sub quote
{ $_[0]->{quote
} }
72 sub escape_char
{ $_[0]->{escape_char
} }
This page took 0.043719 seconds and 4 git commands to generate.