App-AcmeCpanauthors
view release on metacpan or search on metacpan
script/acme-cpanauthors view on Meta::CPAN
# } else {
# require Data::Check::Structure;
# my $data = $res->[2];
# my $max = 1000;
# if (!ref($data)) {
# $data //= "";
# $data .= "\n" unless !length($data) || $data =~ /\n\z/;
# return $data;
# } elsif (ref($data) eq 'ARRAY' && !@$data) {
# return "";
# } elsif (Data::Check::Structure::is_aos($data, {max=>$max})) {
# return join("", map {"$_\n"} @$data);
# } elsif (Data::Check::Structure::is_aoaos($data, {max=>$max})) {
# my $header_row = 0;
# my $data = $data;
# if ($res->[3]{'table.fields'}) {
# $data = [$res->[3]{'table.fields'}, @$data];
# $header_row = 1;
# }
# return __gen_table($data, $header_row, $res->[3], $format);
# } elsif (Data::Check::Structure::is_hos($data, {max=>$max})) {
# $data = [map {[$_, $data->{$_}]} sort keys %$data];
# unshift @$data, ["key", "value"];
# return __gen_table($data, 1, $res->[3], $format);
# } elsif (Data::Check::Structure::is_aohos($data, {max=>$max})) {
# # collect all mentioned fields
# my @fieldnames;
# if ($res->[3] && $res->[3]{'table.fields'} &&
# $res->[3]{'table.hide_unknown_fields'}) {
# @fieldnames = @{ $res->[3]{'table.fields'} };
# } else {
# my %fieldnames;
# for my $row (@$data) {
# $fieldnames{$_}++ for keys %$row;
# }
# @fieldnames = sort keys %fieldnames;
# }
# my $newdata = [];
# for my $row (@$data) {
# push @$newdata, [map {$row->{$_}} @fieldnames];
# }
# unshift @$newdata, \@fieldnames;
# return __gen_table($newdata, 1, $res->[3], $format);
# } else {
# $format = 'json-pretty';
# }
# }
# }
#
# my $tff = $res->[3]{'table.fields'};
# $res = $res->[2] if $is_naked;
#
# if ($format eq 'perl') {
# my $use_color = $ENV{COLOR} // (-t STDOUT);
# if ($use_color && eval { require Data::Dump::Color; 1 }) {
# return Data::Dump::Color::dump($res);
# } elsif (eval { require Data::Dump; 1 }) {
# return Data::Dump::dump($res);
# } else {
# no warnings 'once';
# require Data::Dumper;
# local $Data::Dumper::Terse = 1;
# local $Data::Dumper::Indent = 1;
# local $Data::Dumper::Useqq = 1;
# local $Data::Dumper::Deparse = 1;
# local $Data::Dumper::Quotekeys = 0;
# local $Data::Dumper::Sortkeys = 1;
# local $Data::Dumper::Trailingcomma = 1;
# return Data::Dumper::Dumper($res);
# }
# }
#
# unless ($format =~ /\Ajson(-pretty)?\z/) {
# warn "Unknown format '$format', fallback to json-pretty";
# $format = 'json-pretty';
# }
# __cleanse($res) if ($cleanse//1);
# if ($format =~ /json/) {
# if ($tff && _json->can("sort_by") &&
# eval { require Sort::ByExample; 1}) {
# my $cmp = Sort::ByExample->cmp($tff);
# _json->sort_by(sub { $cmp->($JSON::PP::a, $JSON::PP::b) });
# }
#
# if ($format eq 'json') {
# return _json->encode($res) . "\n";
# } else {
# _json->pretty(1);
# return _json->encode($res);
# }
# }
#}
#
#1;
## ABSTRACT: Format enveloped result
#
#__END__
#
#=pod
#
#=encoding UTF-8
#
#=head1 NAME
#
#Perinci::Result::Format::Lite - Format enveloped result
#
#=head1 VERSION
#
#This document describes version 0.287 of Perinci::Result::Format::Lite (from Perl distribution Perinci-Result-Format-Lite), released on 2022-09-12.
#
#=head1 SYNOPSIS
#
#=head1 DESCRIPTION
#
#This module formats L<enveloped result structure|Rinci::function/"Enveloped
#result"> to "pretty text" if it can do so, e.g. the structure can be represented
#as a 2-dimensional table. Otherwise, it falls back to JSON or Perl. The table
#formats supported include CSV, TSV, LTSV, or HTML. More table formats (e.g. Org,
#Markdown) are supported via L<Text::Table::Any> when you set
#L</"FORMAT_PRETTY_TABLE_BACKEND">.
#
#This module is a more lightweight version of L<Perinci::Result::Format> but the
#long-term goal is to reunite the two formatting modules back to a
#modular/pluggable module.
#
#=for Pod::Coverage ^(firstidx)$
#
#=head1 FUNCTIONS
#
( run in 1.427 second using v1.01-cache-2.11-cpan-4ef0a570458 )