HTML::Auto(3pm)
β¨ HTML::Auto β¨
okay bestie, welcome to HTML::Auto π it's the Perl module that writes HTML for common elements so you don't have to hand-type a billion <td>s like some kind of Victorian orphan. this page lives in the User Contributed Perl Documentation section of the manual, and it's about to be your new hyperfixation π«Ά
πΈ NAME πΈ
HTML::Auto β write HTML for common elements. that's it, that's the whole job, and it does it gorgeously π
π VERSION π
version 0.09
π¦ SYNOPSIS π¦
the simple example (the gateway drug) β¨
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2 c3 c4 c5/;
my @lines = qw/l1 l2 l3 l4 l5/;
my $data =
[ [1,2,3,4,5],
[6,7,8,9,0],
[1,1,1,1,1],
[2,2,2,2,2],
[3,3,3,3,3] ];
my $m = matrix(\@cols,\@lines,$data);
print v(
h($m,$m,$m),
h($m,$m),
);
look at her. matrix builds the thing, h stacks stuff side by side, v stacks stuff on top of each other. iconic behavior fr fr π
using attributes π
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2/;
my @lines = qw/l1 l2/;
my $data =
[
[
{v => 1, a => { style => 'background: green'}},
2
],
[
{v => 3, a => {class => 'foo'}},
{v => 4, a => {style => 'color: red'}}
]
];
my $m = matrix(\@cols,\@lines,$data);
print v(
h($m)
);
so instead of just a value, you can hand her a hashref with v (the value) and a (the attributes). it's giving customization π¨
with mouse-over span π
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2/;
my @lines = qw/l1 l2/;
my $data =
[[1,2],
[3,
{ v=> 4,
more_info => "This is a pop-up!"
}]
];
my $m = matrix(\@cols,\@lines,$data);
print v(
h($m)
);
the more_info key is the little pop-up moment, the hover tea ββ¨
passing additional CSS π
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2/;
my @lines = qw/l1 l2/;
my $data =
[
[
{v => 1, a => { class => 'warn'}},
2
],
[3,4]
];
my $options = { css => '.warn { background-color: yellow !important; }' };
my $m = matrix(\@cols,\@lines,$data,$options);
print v(
h($m)
);
you can literally slide extra CSS in through the $options hashref like a little gift π
π FUNCTIONS π
π matrix π
build a matrix. some options are available to pass to the matrix function, and bestie, let's go through every single one because we don't skip π«Ά
diagonal
highlight the diagonal of the matrix. main character energy, truly.
my $m = matrix(\@cols,\@lines,$data, {diagonal => 1});
format
pass a string to be used by the format filter in the TT2 template.
my $m = matrix(\@cols,\@lines,$data, {format => '%.6f'});
ucfirst
option to uppercase first letter in columns and lines labels. it's a glow-up for your labels π
my $m = matrix(\@cols,\@lines,$data, {ucfirst => 1});
π« h π«
a function to allow horizontal composition. side by side, like besties taking a selfie πΈ
π« v π«
a function to allow vertical composition. stacked, like your iced coffee orders βββ
π AUTHORS π
- Nuno Carvalho <smash@cpan.org>
- AndrΓ© Santos <andrefs@cpan.org>
absolute legends, no cap π
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2012-2016 by Project Natura <natura@natura.di.uminho.pt>.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source rights π«Ά
and that's the whole page, bestie!! πβ¨ this was HTML::Auto from perl v5.34.0, dated 2022-06-14 β go forth and generate HTML like the icon you are π πΈπ¦
π¦ where this page comes from
- debian bookworm: libhtml-auto-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-auto-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-auto-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-auto-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-auto-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms