{
    "content": [
        {
            "type": "text",
            "text": "# HTML::HeadParser (perldoc)\n\n## NAME\n\nHTML::HeadParser - Parse <HEAD> section of a HTML document\n\n## SYNOPSIS\n\nrequire HTML::HeadParser;\n$p = HTML::HeadParser->new;\n$p->parse($text) and  print \"not finished\";\n$p->header('Title')          # to access <title>....</title>\n$p->header('Content-Base')   # to access <base href=\"http://...\">\n$p->header('Foo')            # to access <meta http-equiv=\"Foo\" content=\"...\">\n$p->header('X-Meta-Author')  # to access <meta name=\"author\" content=\"...\">\n$p->header('X-Meta-Charset') # to access <meta charset=\"...\">\n\n## DESCRIPTION\n\nThe \"HTML::HeadParser\" is a specialized (and lightweight) \"HTML::Parser\" that will only parse\nthe <HEAD>...</HEAD> section of an HTML document. The parse() method will return a FALSE value\nas soon as some <BODY> element or body text are found, and should not be called again after\nthis.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **METHODS**\n- **EXAMPLE**\n- **SEE ALSO**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "HTML::HeadParser",
        "section": "",
        "mode": "perldoc",
        "summary": "HTML::HeadParser - Parse <HEAD> section of a HTML document",
        "synopsis": "require HTML::HeadParser;\n$p = HTML::HeadParser->new;\n$p->parse($text) and  print \"not finished\";\n$p->header('Title')          # to access <title>....</title>\n$p->header('Content-Base')   # to access <base href=\"http://...\">\n$p->header('Foo')            # to access <meta http-equiv=\"Foo\" content=\"...\">\n$p->header('X-Meta-Author')  # to access <meta name=\"author\" content=\"...\">\n$p->header('X-Meta-Charset') # to access <meta charset=\"...\">",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "$h = HTTP::Headers->new;",
            "$p = HTML::HeadParser->new($h);",
            "$p->parse(<<EOT);",
            "<title>Stupid example</title>",
            "<base href=\"http://www.linpro.no/lwp/\">",
            "Normal text starts here.",
            "EOT",
            "undef $p;",
            "print $h->title;   # should print \"Stupid example\""
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": [
                    {
                        "name": "parse",
                        "lines": 29
                    }
                ]
            },
            {
                "name": "METHODS",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "EXAMPLE",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "HTML::HeadParser - Parse <HEAD> section of a HTML document\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "require HTML::HeadParser;\n$p = HTML::HeadParser->new;\n$p->parse($text) and  print \"not finished\";\n\n$p->header('Title')          # to access <title>....</title>\n$p->header('Content-Base')   # to access <base href=\"http://...\">\n$p->header('Foo')            # to access <meta http-equiv=\"Foo\" content=\"...\">\n$p->header('X-Meta-Author')  # to access <meta name=\"author\" content=\"...\">\n$p->header('X-Meta-Charset') # to access <meta charset=\"...\">\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The \"HTML::HeadParser\" is a specialized (and lightweight) \"HTML::Parser\" that will only parse\nthe <HEAD>...</HEAD> section of an HTML document. The parse() method will return a FALSE value\nas soon as some <BODY> element or body text are found, and should not be called again after\nthis.\n\nNote that the \"HTML::HeadParser\" might get confused if raw undecoded UTF-8 is passed to the",
                "subsections": [
                    {
                        "name": "parse",
                        "content": "The \"HTML::HeadParser\" keeps a reference to a header object, and the parser will update this\nheader object as the various elements of the <HEAD> section of the HTML document are recognized.\nThe following header fields are affected:\n\nContent-Base:\nThe *Content-Base* header is initialized from the <base href=\"...\"> element.\n\nTitle:\nThe *Title* header is initialized from the <title>...</title> element.\n\nIsindex:\nThe *Isindex* header will be added if there is a <isindex> element in the <head>. The header\nvalue is initialized from the *prompt* attribute if it is present. If no *prompt* attribute\nis given it will have '?' as the value.\n\nX-Meta-Foo:\nAll <meta> elements containing a \"name\" attribute will result in headers using the prefix\n\"X-Meta-\" appended with the value of the \"name\" attribute as the name of the header, and the\nvalue of the \"content\" attribute as the pushed header value.\n\n<meta> elements containing a \"http-equiv\" attribute will result in headers as in above, but\nwithout the \"X-Meta-\" prefix in the header name.\n\n<meta> elements containing a \"charset\" attribute will result in an \"X-Meta-Charset\" header,\nusing the value of the \"charset\" attribute as the pushed header value.\n\nThe ':' character can't be represented in header field names, so if the meta element\ncontains this char it's substituted with '-' before forming the field name.\n"
                    }
                ]
            },
            "METHODS": {
                "content": "The following methods (in addition to those provided by the superclass) are available:\n\n$hp = HTML::HeadParser->new\n$hp = HTML::HeadParser->new( $header )\nThe object constructor. The optional $header argument should be a reference to an object\nthat implement the header() and pushheader() methods as defined by the \"HTTP::Headers\"\nclass. Normally it will be of some class that is a or delegates to the \"HTTP::Headers\"\nclass.\n\nIf no $header is given \"HTML::HeadParser\" will create an \"HTTP::Headers\" object by itself\n(initially empty).\n\n$hp->header;\nReturns a reference to the header object.\n\n$hp->header( $key )\nReturns a header value. It is just a shorter way to write \"$hp->header->header($key)\".\n",
                "subsections": []
            },
            "EXAMPLE": {
                "content": "$h = HTTP::Headers->new;\n$p = HTML::HeadParser->new($h);\n$p->parse(<<EOT);\n<title>Stupid example</title>\n<base href=\"http://www.linpro.no/lwp/\">\nNormal text starts here.\nEOT\nundef $p;\nprint $h->title;   # should print \"Stupid example\"\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "HTML::Parser, HTTP::Headers\n\nThe \"HTTP::Headers\" class is distributed as part of the *libwww-perl* package. If you don't have\nthat distribution installed you need to provide the $header argument to the \"HTML::HeadParser\"\nconstructor with your own object that implements the documented protocol.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 1996-2001 Gisle Aas. All rights reserved.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}