CGI::Pretty(3) User Contributed Perl Documentation CGI::Pretty(3)

# [NAME](#NAME)

CGI::Pretty - module to produce nicely formatted HTML code

# [CGI::Pretty IS DEPRECATED](#CGI::Pretty_IS_DEPRECATED)

It will be removed from the CGI distribution in a future release, so you should no longer use it and remove it from any code that currently uses it.

For now it has been reduced to a shell to prevent your code breaking, but the "pretty" functions will no longer output "pretty" HTML.

# [Alternatives](#Alternatives)

HTML::HTML5::Parser + HTML::HTML5::Writer + XML::LibXML::PrettyPrint:

```
    print HTML::HTML5::Writer->new(
        start_tags => 'force',
        end_tags   => 'force',
    )->document(
        XML::LibXML::PrettyPrint->new_for_html( indent_string => "\t" )
        ->pretty_print(
            HTML::HTML5::Parser->new->parse_string( $html_string )
        )
    );
```

Marpa::R2::HTML (see the html\_fmt script for examples)

HTML::Tidy

HTML::Parser

2026-08-18 perl v5.44.0

---

Document: CGI::Pretty(3pm) from perl-cgi 4.72-r2 (Chainguard OS)
Source: https://github.com/leejo/CGI.pm.git
