Acme-CPANModules-HTMLTable
view release on metacpan or search on metacpan
lib/Acme/CPANModules/HTMLTable.pm view on Meta::CPAN
package Acme::CPANModules::HTMLTable;
use 5.010001;
use strict;
use warnings;
#use utf8;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-10-29'; # DATE
our $DIST = 'Acme-CPANModules-HTMLTable'; # DIST
our $VERSION = '0.002'; # VERSION
sub _make_table {
my ($cols, $rows, $celltext) = @_;
my $res = [];
push @$res, [];
for (0..$cols-1) { $res->[0][$_] = "col" . ($_+1) }
for my $row (1..$rows) {
push @$res, [ map { $celltext // "row$row.$_" } 1..$cols ];
}
$res;
}
our $LIST = {
summary => 'List of modules that generate HTML tables',
entry_features => {
},
entries => [
{
module => 'Text::Table::Any',
description => <<'_',
This is a common frontend for many text table modules as backends,
L<Text::Table::HTML> being one.
_
bench_code => sub {
my ($table) = @_;
Text::Table::Any::table(rows=>$table, header_row=>1, backend=>'Text::Table::HTML');
},
features => {
},
},
{
module => 'Text::Table::HTML',
bench_code => sub {
my ($table) = @_;
Text::Table::HTML::table(rows=>$table, header_row=>1);
},
features => {
},
},
{
module => 'Text::Table::HTML::DataTables',
bench_code => sub {
my ($table) = @_;
Text::Table::HTML::DataTables::table(rows=>$table, header_row=>1);
},
features => {
},
},
{
module => 'Text::Table::Manifold',
bench_code => sub {
my ($table) = @_;
my $t = Text::Table::Manifold->new(format => Text::Table::Manifold::format_html_table());
$t->headers($table->[0]);
$t->data([ @{$table}[1 .. $#{$table}] ]);
join("\n", @{$t->render(padding => 1)}) . "\n";
},
features => {
},
},
], # entries
bench_datasets => [
{name=>'tiny (1x1)' , argv => [_make_table( 1, 1)],},
{name=>'small (3x5)' , argv => [_make_table( 3, 5)],},
{name=>'wide (30x5)' , argv => [_make_table(30, 5)],},
{name=>'long (3x300)' , argv => [_make_table( 3, 300)],},
{name=>'large (30x300)' , argv => [_make_table(30, 300)],},
],
};
1;
# ABSTRACT: List of modules that generate HTML tables
__END__
=pod
=encoding UTF-8
=head1 NAME
Acme::CPANModules::HTMLTable - List of modules that generate HTML tables
=head1 VERSION
This document describes version 0.002 of Acme::CPANModules::HTMLTable (from Perl distribution Acme-CPANModules-HTMLTable), released on 2023-10-29.
=head1 SYNOPSIS
To run benchmark with default option:
% bencher --cpanmodules-module HTMLTable
To run module startup overhead benchmark:
% bencher --module-startup --cpanmodules-module HTMLTable
For more options (dump scenario, list/include/exclude/add participants, list/include/exclude/add datasets, etc), see L<bencher> or run C<bencher --help>.
=head1 ACME::CPANMODULES ENTRIES
=over
=item L<Text::Table::Any>
Author: L<PERLANCAR|https://metacpan.org/author/PERLANCAR>
This is a common frontend for many text table modules as backends,
L<Text::Table::HTML> being one.
=item L<Text::Table::HTML>
Author: L<PERLANCAR|https://metacpan.org/author/PERLANCAR>
lib/Acme/CPANModules/HTMLTable.pm view on Meta::CPAN
This Acme::CPANModules module contains benchmark instructions. You can run a
benchmark for some/all the modules listed in this Acme::CPANModules module using
the L<bencher> CLI (from L<Bencher> distribution):
% bencher --cpanmodules-module HTMLTable
This Acme::CPANModules module also helps L<lcpan> produce a more meaningful
result for C<lcpan related-mods> command when it comes to finding related
modules for the modules listed in this Acme::CPANModules module.
See L<App::lcpan::Cmd::related_mods> for more details on how "related modules"
are found.
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Acme-CPANModules-HTMLTable>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-Acme-CPANModules-HTMLTable>.
=head1 SEE ALSO
L<Acme::CPANModules::TextTable>
L<Acme::CPANModules> - about the Acme::CPANModules namespace
L<cpanmodules> - CLI tool to let you browse/view the lists
=head1 AUTHOR
perlancar <perlancar@cpan.org>
=head1 CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.
Most of the time, you don't need to build the distribution yourself. You can
simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally on your
system), you can install L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
that are considered a bug and can be reported to me.
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2023, 2021 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANModules-HTMLTable>
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.
=cut
( run in 1.594 second using v1.01-cache-2.11-cpan-39bf76dae61 )