App-Codeowners

 view release on metacpan or  search on metacpan

lib/App/Codeowners/Formatter/CSV.pm  view on Meta::CPAN

}


sub text_csv {
    my $self = shift;

    $self->{text_csv} ||= do {
        eval { require Text::CSV } or die "Missing dependency: Text::CSV\n";

        my %options;
        $options{escape_char} = $self->escape_char if $self->escape_char;
        $options{quote}       = $self->quote       if $self->quote;
        $options{sep}         = $self->sep         if $self->sep;
        if ($options{sep} && $options{sep} eq ($options{quote} || '"')) {
            die "Invalid separator value for CSV format.\n";
        }

        Text::CSV->new({binary => 1, eol => $/, %options});
    } or die "Failed to construct Text::CSV object";
}


sub sep         { $_[0]->{sep} || $_[0]->format }
sub quote       { $_[0]->{quote} }
sub escape_char { $_[0]->{escape_char} }

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

lib/App/Codeowners/Formatter/CSV.pm  view on Meta::CPAN

Get the L<Text::CSV> instance.

=head2 sep

Get the value used for L<Text::CSV/sep>.

=head2 quote

Get the value used for L<Text::CSV/quote>.

=head2 escape_char

Get the value used for L<Text::CSV/escape_char>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website
L<https://github.com/chazmcgarvey/git-codeowners/issues>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

lib/App/Codeowners/Util.pm  view on Meta::CPAN



# The stringf code is from String::Format (thanks SREZIC), with changes:
# - Use Unicode::GCString for better Unicode character padding,
# - Strip ANSI color sequences,
# - Prevent 'Negative repeat count does nothing' warnings
sub _replace {
    my ($args, $orig, $alignment, $min_width,
        $max_width, $passme, $formchar) = @_;

    # For unknown escapes, return the orignial
    return $orig unless defined $args->{$formchar};

    $alignment = '+' unless defined $alignment;

    my $replacement = $args->{$formchar};
    if (ref $replacement eq 'CODE') {
        # $passme gets passed to subrefs.
        $passme ||= "";
        $passme =~ tr/{}//d;
        $replacement = $replacement->($passme);



( run in 0.802 second using v1.01-cache-2.11-cpan-c21f80fb71c )