{
    "mode": "perldoc",
    "parameter": "HTML::Diff",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/HTML%3A%3ADiff/json",
    "generated": "2026-06-13T21:33:14Z",
    "synopsis": "use HTML::Diff;\n$result = htmlworddiff($lefttext, $righttext);",
    "sections": {
        "NAME": {
            "content": "HTML::Diff - compare two HTML strings and return a list of differences\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use HTML::Diff;\n\n$result = htmlworddiff($lefttext, $righttext);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module compares two strings of HTML and returns a list of a chunks which indicate the diff\nbetween the two input strings, where changes in formatting are considered changes.\n\nHTML::Diff does not strictly parse the HTML. Instead, it uses regular expressions to make a\ndecent effort at understanding the given HTML. As a result, there are many valid HTML documents\nfor which it will not produce the correct answer. But there may be some invalid HTML documents\nfor which it gives you the answer you're looking for. Your mileage may vary; test it on lots of\ninputs from your domain before relying on it.\n\nReturns a reference to a list of triples [<flag>, <left>, <right>]. Each triple represents a\ncheck of the input texts. The flag tells you whether it represents a deletion, insertion, a\nmodification, or an unchanged chunk.\n\nEvery character of each input text is accounted for by some triple in the output. Specifically,\nConcatenating all the <left> members from the return value should produce $lefttext, and\nlikewise the <right> members concatenate together to produce $righttext.\n\nThe <flag> is either 'u', '+', '-', or 'c', indicating whether the two chunks are the same, the\n$righttext contained this chunk and the left chunk didn't, or vice versa, or the two chunks are\nsimply different. This follows the usage of Algorithm::Diff.\n\nThe difference is computed on a word-by-word basis, \"breaking\" on visible words in the HTML\ntext. If a tag only is changed, it will not be returned as an independent chunk but will be\nshown as a change to one of the neighboring words. For balanced tags, such as <b> </b>, it is\nintended that a change to the tag will be treated as a change to all words in between.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Algorithm::Diff provides the diff algorithm used in this module.\n\nXML::Diff can generate a diff between two XML files, and also patch an XML file, given a diff.\n",
            "subsections": []
        },
        "REPOSITORY": {
            "content": "<https://github.com/neilb/html-diff>\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Whipped up by Ezra elias kilty Cooper, <ezra@ezrakilty.net>.\n\nPatch contributed by Adam <asjo@koldfront.dk>.\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "Copyright 2003-2014 by Ezra elias kilty Cooper, <ezra@ezrakilty.net>\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "HTML::Diff - compare two HTML strings and return a list of differences",
    "flags": [],
    "examples": [],
    "see_also": []
}