{
    "mode": "perldoc",
    "parameter": "HTML::Formatter",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/HTML%3A%3AFormatter/json",
    "generated": "2026-08-13T13:14:53Z",
    "synopsis": "use HTML::FormatSomething;\nmy $infile  = \"whatever.html\";\nmy $outfile = \"whatever.file\";\nopen OUT, \">$outfile\"\nor die \"Can't write-open $outfile: $!\\n\";\nprint OUT HTML::FormatSomething->formatfile(\n$infile,\n'option1' => 'value1',\n'option2' => 'value2',\n...\n);\nclose(OUT);",
    "sections": {
        "NAME": {
            "content": "HTML::Formatter - Base class for HTML formatters\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.16\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use HTML::FormatSomething;\nmy $infile  = \"whatever.html\";\nmy $outfile = \"whatever.file\";\nopen OUT, \">$outfile\"\nor die \"Can't write-open $outfile: $!\\n\";\n\nprint OUT HTML::FormatSomething->formatfile(\n$infile,\n'option1' => 'value1',\n'option2' => 'value2',\n...\n);\nclose(OUT);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "HTML::Formatter is a base class for classes that take HTML and format it to some output format.\nWhen you take an object of such a base class and call \"$formatter-\"format( $tree )> with an\nHTML::TreeBuilder (or HTML::Element) object, they return the appropriately formatted string for\nthe input HTML.\n\nHTML formatters are able to format a HTML syntax tree into various printable formats. Different\nformatters produce output for different output media. Common for all formatters are that they\nwill return the formatted output when the format() method is called. The format() method takes a\nHTML::Element object (usually the HTML::TreeBuilder root object) as parameter.\n\nThe distribution name has been changed to \"HTML-Formatter\" as detailed in \"DISTRIBUTION NAME\"\n",
            "subsections": []
        },
        "METHODS": {
            "content": "new\nmy $formatter = FormatterClass->new(\noption1 => value1, option2 => value2, ...\n);\n\nThis creates a new formatter object with the given options.\n\nformatfile\nformatfromfile\n$string = FormatterClass->formatfile(\n$htmlsource,\noption1 => value1, option2 => value2, ...\n);\n\nReturn a string consisting of the result of using the given class to format the given HTML file\naccording to the given (optional) options. Internally it calls \"SomeClass->new( ... )->format(\n... )\" on a new HTML::TreeBuilder object based on the given HTML file.\n\nformatstring\nformatfromstring\n$string = FormatterClass->formatstring(\n$htmlsource,\noption1 => value1, option2 => value2, ...\n);\n\nReturn a string consisting of the result of using the given class to format the given HTML\nsource according to the given (optional) options. Internally it calls \"SomeClass->new( ...\n)->format( ... )\" on a new HTML::TreeBuilder object based on the given source.\n\nformat\nmy $renderstring = $formatter->format( $htmltreeobject );\n\nThis renders the given HTML object according to the options set for $formatter.\n\nAfter you've used a particular formatter object to format a particular HTML tree object, you\nprobably should not use either again.\n",
            "subsections": []
        },
        "DISTRIBUTION NAME": {
            "content": "This module was originally named \"HTML-Format\" despite not containing a \"HTML::Format\" module\nwithin it. As rules on naming have been taken more seriously, and the PAUSE\n<https://pause.perl.org/> toolchain adapted so that getting the distribution indexed was more\ndifficult, it became obvious that I should rename the distribution to \"HTML-Formatter\" matching\nthe base HTML::Formatter module.\n\nAs of release 2.13 this is released as the \"HTML-Formatter\" distribution with corresponding\nchanges to the git repository name and associated items.\n\nDue to the way that the module is put together this should have no effect on code using the\nmodule. The only issues will be where the distribution name was used within dependancies.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "The three specific formatters:-\n\nHTML::FormatText\nFormat HTML into plain text\n\nHTML::FormatPS\nFormat HTML into postscript\n\nHTML::FormatRTF\nFormat HTML into Rich Text Format\n\nAlso the HTML manipulation libraries used - HTML::TreeBuilder, HTML::Element and HTML::Tree\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Bugs / Feature Requests\nPlease report any bugs or feature requests through the issue tracker at\n<http://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Formatter>. You will be notified\nautomatically of any progress on your issue.\n",
            "subsections": [
                {
                    "name": "Source Code",
                    "content": "This is open source software. The code repository is available for public review and\ncontribution under the terms of the license.\n\n<https://github.com/nigelm/html-formatter>\n\ngit clone https://github.com/nigelm/html-formatter.git\n"
                }
            ]
        },
        "AUTHORS": {
            "content": "*   Nigel Metheringham <nigelm@cpan.org>\n\n*   Sean M Burke <sburke@cpan.org>\n\n*   Gisle Aas <gisle@ActiveState.com>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2016 by Nigel Metheringham, 2002-2005 Sean M Burke, 1999-2002\nGisle Aas.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "HTML::Formatter - Base class for HTML formatters",
    "flags": [],
    "examples": [],
    "see_also": []
}