HTML::Auto(3pm)

πŸ“¦
version 0.09 Β· 2 versions
  • 0.09 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.09 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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 πŸ’œ


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