in reply to Properly indented using HTML::Tiny

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>