In the past I have used CGI::Pretty (part of CGI) to do something similar. Very useful when debugging tables. Not exactly what you're asking for though.

This CGI::Pretty code more-or-less duplicates your HTML::Tiny sample code:

#!/usr/bin/perl use strict; use warnings; use diagnostics; use CGI::Pretty qw(-oldstyle_urls -no_xhtml); my $q = CGI::Pretty->new(); print $q->start_html(-title => 'Sample page'); print $q->h1({-class => 'main'}, 'Sample page'); print $q->p('Hello, World'); print $q->p({-class => 'detail' }, 'Second para' ); print $q->end_html();
Output is:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en-US"><head><title>Sample page</title> </head> <body> <h1 class="main"> Sample page </h1> <p> Hello, World </p> <p class="detail"> Second para </p> </body> </html>


In reply to Re: Properly indented using HTML::Tiny by gmargo
in thread Properly indented using HTML::Tiny by SnowWolf75

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.