{
    "content": [
        {
            "type": "text",
            "text": "# CGI::HTML::Functions (perldoc)\n\n## NAME\n\nCGI::HTML::Functions - Documentation for CGI.pm Legacy HTML Functionality\n\n## SYNOPSIS\n\nNothing here - please do not use this functionality, it is considered to be legacy and\nessentially deprecated. This documentation exists solely to aid in maintenance and migration of\nlegacy code using this functionality and you are strongly encouraged to migrate away from it. If\nyou are working on new code you should be using a template engine. For more information see\nCGI::Alternatives.\nIf you really want to continue using the HTML generation functionality of CGI.pm then you should\ntake a look at HTML::Tiny instead, which may give you a migration path away from CGI.pm's html\ngeneration functions; i strongly encourage you to move towards template driven page generation\nfor anything involving markup as it will make porting your app to other frameworks much easier\nin the long run.\n\n## DESCRIPTION\n\nThe documentation here should be considered an addendum to the sections in the CGI documentation\n- the sections here are named the same as those within the CGI perldoc.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **Calling CGI.pm routines** (61 subsections)\n- **WORKING WITH FRAMES**\n- **SUPPORT FOR JAVASCRIPT** (1 subsections)\n- **LIMITED SUPPORT FOR CASCADING STYLE SHEETS**\n- **BUGS**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CGI::HTML::Functions",
        "section": "",
        "mode": "perldoc",
        "summary": "CGI::HTML::Functions - Documentation for CGI.pm Legacy HTML Functionality",
        "synopsis": "Nothing here - please do not use this functionality, it is considered to be legacy and\nessentially deprecated. This documentation exists solely to aid in maintenance and migration of\nlegacy code using this functionality and you are strongly encouraged to migrate away from it. If\nyou are working on new code you should be using a template engine. For more information see\nCGI::Alternatives.\nIf you really want to continue using the HTML generation functionality of CGI.pm then you should\ntake a look at HTML::Tiny instead, which may give you a migration path away from CGI.pm's html\ngeneration functions; i strongly encourage you to move towards template driven page generation\nfor anything involving markup as it will make porting your app to other frameworks much easier\nin the long run.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "Calling CGI.pm routines",
                "lines": 32,
                "subsections": [
                    {
                        "name": "Function-oriented interface HTML exports",
                        "lines": 28
                    },
                    {
                        "name": "Pragmas",
                        "lines": 2
                    },
                    {
                        "name": "-nosticky",
                        "lines": 9
                    },
                    {
                        "name": "-tabindex",
                        "lines": 4
                    },
                    {
                        "name": "-no_xhtml",
                        "lines": 7
                    },
                    {
                        "name": "Special forms for importing HTML-tag functions",
                        "lines": 14
                    },
                    {
                        "name": "Creating the HTML document header",
                        "lines": 213
                    },
                    {
                        "name": "Ending the Html document:",
                        "lines": 38
                    },
                    {
                        "name": "Providing arguments to HTML shortcuts",
                        "lines": 37
                    },
                    {
                        "name": "The distributive property of HTML shortcuts",
                        "lines": 53
                    },
                    {
                        "name": "Non-standard HTML shortcuts",
                        "lines": 2
                    },
                    {
                        "name": "comment",
                        "lines": 15
                    },
                    {
                        "name": "Autoescaping HTML",
                        "lines": 21
                    },
                    {
                        "name": "escapeHTML",
                        "lines": 52
                    },
                    {
                        "name": "end_form",
                        "lines": 4
                    },
                    {
                        "name": "Creating an isindex tag",
                        "lines": 9
                    },
                    {
                        "name": "Starting and ending a form",
                        "lines": 12
                    },
                    {
                        "name": "start_form",
                        "lines": 7
                    },
                    {
                        "name": "end_form",
                        "lines": 1
                    },
                    {
                        "name": "start_form",
                        "lines": 34
                    },
                    {
                        "name": "Form elements",
                        "lines": 4
                    },
                    {
                        "name": "-name",
                        "lines": 3
                    },
                    {
                        "name": "-value, -values",
                        "lines": 4
                    },
                    {
                        "name": "-tabindex",
                        "lines": 5
                    },
                    {
                        "name": "-override",
                        "lines": 3
                    },
                    {
                        "name": "-onChange, -onFocus, -onBlur, -onMouseOver, -onMouseOut, -onSelect",
                        "lines": 6
                    },
                    {
                        "name": "Creating a text field",
                        "lines": 8
                    },
                    {
                        "name": "textfield",
                        "lines": 23
                    },
                    {
                        "name": "Creating a big text field",
                        "lines": 9
                    },
                    {
                        "name": "textarea",
                        "lines": 3
                    },
                    {
                        "name": "Creating a password field",
                        "lines": 8
                    },
                    {
                        "name": "password_field",
                        "lines": 2
                    },
                    {
                        "name": "Creating a file upload field",
                        "lines": 8
                    },
                    {
                        "name": "filefield",
                        "lines": 1
                    },
                    {
                        "name": "start_form",
                        "lines": 1
                    },
                    {
                        "name": "start_multipart_form",
                        "lines": 20
                    },
                    {
                        "name": "Creating a popup menu",
                        "lines": 22
                    },
                    {
                        "name": "popup_menu",
                        "lines": 26
                    },
                    {
                        "name": "Creating an option group",
                        "lines": 19
                    },
                    {
                        "name": "optgroup",
                        "lines": 28
                    },
                    {
                        "name": "Creating a scrolling list",
                        "lines": 20
                    },
                    {
                        "name": "scrolling_list",
                        "lines": 27
                    },
                    {
                        "name": "Creating a group of related checkboxes",
                        "lines": 19
                    },
                    {
                        "name": "checkbox_group",
                        "lines": 57
                    },
                    {
                        "name": "Creating a standalone checkbox",
                        "lines": 9
                    },
                    {
                        "name": "checkbox",
                        "lines": 18
                    },
                    {
                        "name": "Creating a radio button group",
                        "lines": 19
                    },
                    {
                        "name": "radio_group",
                        "lines": 61
                    },
                    {
                        "name": "Creating a submit button",
                        "lines": 7
                    },
                    {
                        "name": "submit",
                        "lines": 16
                    },
                    {
                        "name": "Creating a reset button",
                        "lines": 2
                    },
                    {
                        "name": "reset",
                        "lines": 5
                    },
                    {
                        "name": "Creating a default button",
                        "lines": 2
                    },
                    {
                        "name": "defaults",
                        "lines": 2
                    },
                    {
                        "name": "Creating a hidden field",
                        "lines": 7
                    },
                    {
                        "name": "hidden",
                        "lines": 21
                    },
                    {
                        "name": "Creating a clickable image button",
                        "lines": 8
                    },
                    {
                        "name": "image_button",
                        "lines": 12
                    },
                    {
                        "name": "param",
                        "lines": 1
                    },
                    {
                        "name": "Creating a javascript action button",
                        "lines": 8
                    },
                    {
                        "name": "button",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "WORKING WITH FRAMES",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "SUPPORT FOR JAVASCRIPT",
                "lines": 106,
                "subsections": [
                    {
                        "name": "start_form",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "LIMITED SUPPORT FOR CASCADING STYLE SHEETS",
                "lines": 133,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CGI::HTML::Functions - Documentation for CGI.pm Legacy HTML Functionality\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "Nothing here - please do not use this functionality, it is considered to be legacy and\nessentially deprecated. This documentation exists solely to aid in maintenance and migration of\nlegacy code using this functionality and you are strongly encouraged to migrate away from it. If\nyou are working on new code you should be using a template engine. For more information see\nCGI::Alternatives.\n\nIf you really want to continue using the HTML generation functionality of CGI.pm then you should\ntake a look at HTML::Tiny instead, which may give you a migration path away from CGI.pm's html\ngeneration functions; i strongly encourage you to move towards template driven page generation\nfor anything involving markup as it will make porting your app to other frameworks much easier\nin the long run.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The documentation here should be considered an addendum to the sections in the CGI documentation\n- the sections here are named the same as those within the CGI perldoc.\n",
                "subsections": []
            },
            "Calling CGI.pm routines": {
                "content": "HTML tag functions have both attributes (the attribute=\"value\" pairs within the tag itself) and\ncontents (the part between the opening and closing pairs). To distinguish between attributes and\ncontents, CGI.pm uses the convention of passing HTML attributes as a hash reference as the first\nargument, and the contents, if any, as any subsequent arguments. It works out like this:\n\nCode                           Generated HTML\n----                           --------------\nh1()                           <h1 />\nh1('some','contents');         <h1>some contents</h1>\nh1({-align=>left});            <h1 align=\"LEFT\">\nh1({-align=>left},'contents'); <h1 align=\"LEFT\">contents</h1>\n\nMany newcomers to CGI.pm are puzzled by the difference between the calling conventions for the\nHTML shortcuts, which require curly braces around the HTML tag attributes, and the calling\nconventions for other routines, which manage to generate attributes without the curly brackets.\nDon't be confused. As a convenience the curly braces are optional in all but the HTML shortcuts.\nIf you like, you can use curly braces when calling any routine that takes named arguments. For\nexample:\n\nprint $q->header( { -type => 'image/gif', -expires => '+3d' } );\n\nIf you use warnings, you will be warned that some CGI.pm argument names conflict with built-in\nperl functions. The most frequent of these is the -values argument, used to create multi-valued\nmenus, radio button clusters and the like. To get around this warning, you have several choices:\n\n1.  Use another name for the argument, if one is available. For example, -value is an alias for\n-values.\n\n2.  Change the capitalization, e.g. -Values\n\n3.  Put quotes around the argument name, e.g. '-values'\n",
                "subsections": [
                    {
                        "name": "Function-oriented interface HTML exports",
                        "content": "Here is a list of the HTML related function sets you can import:\n\n:form\nImport all fill-out form generating methods, such as textfield().\n\n:html2\nImport all methods that generate HTML 2.0 standard elements.\n\n:html3\nImport all methods that generate HTML 3.0 elements (such as <table>, <super> and <sub>).\n\n:html4\nImport all methods that generate HTML 4 elements (such as <abbrev>, <acronym> and <thead>).\n\n:netscape\nImport the <blink>, <fontsize> and <center> tags.\n\n:html\nImport all HTML-generating shortcuts (i.e. 'html2', 'html3', 'html4' and 'netscape')\n\n:standard\nImport \"standard\" features, 'html2', 'html3', 'html4', 'ssl', 'form' and 'cgi'.\n\nIf you import any of the state-maintaining CGI or form-generating methods, a default CGI object\nwill be created and initialized automatically the first time you use any of the methods that\nrequire one to be present. This includes param(), textfield(), submit() and the like. (If you\nneed direct access to the CGI object, you can find it in the global variable $CGI::Q).\n"
                    },
                    {
                        "name": "Pragmas",
                        "content": "Additional HTML generation related pragms:\n"
                    },
                    {
                        "name": "-nosticky",
                        "content": "By default the CGI module implements a state-preserving behavior called \"sticky\" fields. The\nway this works is that if you are regenerating a form, the methods that generate the form\nfield values will interrogate param() to see if similarly-named parameters are present in\nthe query string. If they find a like-named parameter, they will use it to set their default\nvalues.\n\nSometimes this isn't what you want. The -nosticky pragma prevents this behavior. You can\nalso selectively change the sticky behavior in each element that you generate.\n"
                    },
                    {
                        "name": "-tabindex",
                        "content": "Automatically add tab index attributes to each form field. With this option turned off, you\ncan still add tab indexes manually by passing a -tabindex option to each field-generating\nmethod.\n"
                    },
                    {
                        "name": "-no_xhtml",
                        "content": "By default, CGI.pm versions 2.69 and higher emit XHTML (http://www.w3.org/TR/xhtml1/). The\n-noxhtml pragma disables this feature. Thanks to Michalis Kabrianis <kabrianis@hellug.gr>\nfor this feature.\n\nIf starthtml()'s -dtd parameter specifies an HTML 2.0, 3.2, 4.0 or 4.01 DTD, XHTML will\nautomatically be disabled without needing to use this pragma.\n"
                    },
                    {
                        "name": "Special forms for importing HTML-tag functions",
                        "content": "Many of the methods generate HTML tags. As described below, tag functions automatically generate\nboth the opening and closing tags. For example:\n\nprint h1('Level 1 Header');\n\nproduces\n\n<h1>Level 1 Header</h1>\n\nThere will be some times when you want to produce the start and end tags yourself. In this case,\nyou can use the form start*tagname* and end*tagname*, as in:\n\nprint starth1,'Level 1 Header',endh1;\n"
                    },
                    {
                        "name": "Creating the HTML document header",
                        "content": "print starthtml(\n-title      => 'Secrets of the Pyramids',\n-author     => 'fred@capricorn.org',\n-base       => 'true',\n-target     => 'blank',\n-meta       => {'keywords'=>'pharaoh secret mummy',\n'copyright' => 'copyright 1996 King Tut'},\n-style      => {'src'=>'/styles/style1.css'},\n-BGCOLOR    => 'blue'\n);\n\nThe starthtml() routine creates the top of the page, along with a lot of optional information\nthat controls the page's appearance and behavior.\n\nThis method returns a canned HTML header and the opening <body> tag. All parameters are\noptional. In the named parameter form, recognized parameters are -title, -author, -base, -xbase,\n-dtd, -lang and -target (see below for the explanation). Any additional parameters you provide,\nsuch as the unofficial BGCOLOR attribute, are added to the <body> tag. Additional parameters\nmust be proceeded by a hyphen.\n\nThe argument -xbase allows you to provide an HREF for the <base> tag different from the current\nlocation, as in\n\n-xbase => \"http://home.mcom.com/\"\n\nAll relative links will be interpreted relative to this tag.\n\nThe argument -target allows you to provide a default target frame for all the links and fill-out\nforms on the page. This is a non-standard HTTP feature which only works with some browsers!\n\n-target => \"answerwindow\"\n\nAll relative links will be interpreted relative to this tag. You add arbitrary meta information\nto the header with the -meta argument. This argument expects a reference to a hash containing\nname/value pairs of meta information. These will be turned into a series of header <meta> tags\nthat look something like this:\n\n<meta name=\"keywords\" content=\"pharaoh secret mummy\">\n<meta name=\"description\" content=\"copyright 1996 King Tut\">\n\nTo create an HTTP-EQUIV type of <meta> tag, use -head, described below.\n\nThe -style argument is used to incorporate cascading stylesheets into your code. See the section\non CASCADING STYLESHEETS for more information.\n\nThe -lang argument is used to incorporate a language attribute into the <html> tag. For example:\n\nprint $q->starthtml( -lang => 'fr-CA' );\n\nThe default if not specified is \"en-US\" for US English, unless the -dtd parameter specifies an\nHTML 2.0 or 3.2 DTD, in which case the lang attribute is left off. You can force the lang\nattribute to left off in other cases by passing an empty string (-lang=>'').\n\nThe -encoding argument can be used to specify the character set for XHTML. It defaults to\niso-8859-1 if not specified.\n\nThe -dtd argument can be used to specify a public DTD identifier string. For example:\n\n-dtd => '-//W3C//DTD HTML 4.01 Transitional//EN')\n\nAlternatively, it can take public and system DTD identifiers as an array:\n\n-dtd => [\n'-//W3C//DTD HTML 4.01 Transitional//EN',\n'http://www.w3.org/TR/html4/loose.dtd'\n]\n\nFor the public DTD identifier to be considered, it must be valid. Otherwise it will be replaced\nby the default DTD. If the public DTD contains 'XHTML', CGI.pm will emit XML.\n\nThe -declarexml argument, when used in conjunction with XHTML, will put a <?xml> declaration at\nthe top of the HTML header. The sole purpose of this declaration is to declare the character set\nencoding. In the absence of -declarexml, the output HTML will contain a <meta> tag that\nspecifies the encoding, allowing the HTML to pass most validators. The default for -declarexml\nis false.\n\nYou can place other arbitrary HTML elements to the <head> section with the -head tag. For\nexample, to place a <link> element in the head section, use this:\n\nprint starthtml(\n-head => Link({\n-rel  => 'shortcut icon',\n-href => 'favicon.ico'\n})\n);\n\nTo incorporate multiple HTML elements into the <head> section, just pass an array reference:\n\nprint starthtml(\n-head => [\nLink({\n-rel  => 'next',\n-href => 'http://www.capricorn.com/s2.html'\n}),\nLink({\n-rel  => 'previous',\n-href => 'http://www.capricorn.com/s1.html'\n})\n]\n);\n\nAnd here's how to create an HTTP-EQUIV <meta> tag:\n\nprint starthtml(\n-head => meta({\n-httpequiv => 'Content-Type',\n-content    => 'text/html'\n})\n);\n\nJAVASCRIPTING: The -script, -noScript, -onLoad, -onMouseOver, -onMouseOut and -onUnload\nparameters are used to add JavaScript calls to your pages. -script should point to a block of\ntext containing JavaScript function definitions. This block will be placed within a <script>\nblock inside the HTML (not HTTP) header. The block is placed in the header in order to give your\npage a fighting chance of having all its JavaScript functions in place even if the user presses\nthe stop button before the page has loaded completely. CGI.pm attempts to format the script in\nsuch a way that JavaScript-naive browsers will not choke on the code: unfortunately there are\nsome browsers that get confused by it nevertheless.\n\nThe -onLoad and -onUnload parameters point to fragments of JavaScript code to execute when the\npage is respectively opened and closed by the browser. Usually these parameters are calls to\nfunctions defined in the -script field:\n\n$q = CGI->new;\nprint header;\n$JSCRIPT = <<END;\n// Ask a silly question\nfunction riddlemethis() {\nvar r = prompt(\n\"What walks on four legs in the morning, \" +\n\"two legs in the afternoon, \" +\n\"and three legs in the evening?\"\n);\nresponse(r);\n}\n// Get a silly answer\nfunction response(answer) {\nif (answer == \"man\")\nalert(\"Right you are!\");\nelse\nalert(\"Wrong!  Guess again.\");\n}\nEND\nprint starthtml(\n-title  => 'The Riddle of the Sphinx',\n-script => $JSCRIPT\n);\n\nUse the -noScript parameter to pass some HTML text that will be displayed on browsers that do\nnot have JavaScript (or browsers where JavaScript is turned off).\n\nThe <script> tag, has several attributes including \"type\", \"charset\" and \"src\". \"src\" allows you\nto keep JavaScript code in an external file. To use these attributes pass a HASH reference in\nthe -script parameter containing one or more of -type, -src, or -code:\n\nprint $q->starthtml(\n-title  => 'The Riddle of the Sphinx',\n-script => {\n-type => 'JAVASCRIPT',\n-src  => '/javascript/sphinx.js'}\n);\n\nprint $q->(\n-title  => 'The Riddle of the Sphinx',\n-script => {\n-type => 'PERLSCRIPT',\n-code => 'print \"hello world!\\n;\"'\n}\n);\n\nA final feature allows you to incorporate multiple <script> sections into the header. Just pass\nthe list of script sections as an array reference. This allows you to specify different source\nfiles for different dialects of JavaScript. Example:\n\nprint $q->starthtml(\n-title  => 'The Riddle of the Sphinx',\n-script => [\n{\n-type => 'text/javascript',\n-src  => '/javascript/utilities10.js'\n},\n{\n-type => 'text/javascript',\n-src  => '/javascript/utilities11.js'\n},\n{\n-type => 'text/jscript',\n-src  => '/javascript/utilities12.js'\n},\n{\n-type => 'text/ecmascript',\n-src  => '/javascript/utilities219.js'\n}\n]\n);\n\nThe option \"-language\" is a synonym for -type, and is supported for backwards compatibility.\n\nThe old-style positional parameters are as follows:\n\nParameters:\n\n1.  The title\n\n2.  The author's e-mail address (will create a <link rev=\"MADE\"> tag if present\n\n3.  A 'true' flag if you want to include a <base> tag in the header. This helps resolve relative\naddresses to absolute ones when the document is moved, but makes the document hierarchy\nnon-portable. Use with care!\n\nOther parameters you want to include in the <body> tag may be appended to these. This is a good\nplace to put HTML extensions, such as colors and wallpaper patterns.\n"
                    },
                    {
                        "name": "Ending the Html document:",
                        "content": "print $q->endhtml;\n\nThis ends an HTML document by printing the </body></html> tags.\n\nCREATING STANDARD HTML ELEMENTS:\nCGI.pm defines general HTML shortcut methods for many HTML tags. HTML shortcuts are named after\na single HTML element and return a fragment of HTML text. Example:\n\nprint $q->blockquote(\n\"Many years ago on the island of\",\n$q->a({href=>\"http://crete.org/\"},\"Crete\"),\n\"there lived a Minotaur named\",\n$q->strong(\"Fred.\"),\n),\n$q->hr;\n\nThis results in the following HTML code (extra newlines have been added for readability):\n\n<blockquote>\nMany years ago on the island of\n<a href=\"http://crete.org/\">Crete</a> there lived\na minotaur named <strong>Fred.</strong>\n</blockquote>\n<hr>\n\nIf you find the syntax for calling the HTML shortcuts awkward, you can import them into your\nnamespace and dispense with the object syntax completely (see the next section for more\ndetails):\n\nuse CGI ':standard';\nprint blockquote(\n\"Many years ago on the island of\",\na({href=>\"http://crete.org/\"},\"Crete\"),\n\"there lived a minotaur named\",\nstrong(\"Fred.\"),\n),\nhr;\n"
                    },
                    {
                        "name": "Providing arguments to HTML shortcuts",
                        "content": "The HTML methods will accept zero, one or multiple arguments. If you provide no arguments, you\nget a single tag:\n\nprint hr;    #  <hr>\n\nIf you provide one or more string arguments, they are concatenated together with spaces and\nplaced between opening and closing tags:\n\nprint h1(\"Chapter\",\"1\"); # <h1>Chapter 1</h1>\"\n\nIf the first argument is a hash reference, then the keys and values of the hash become the HTML\ntag's attributes:\n\nprint a({-href=>'fred.html',-target=>'new'},\n\"Open a new frame\");\n\n<a href=\"fred.html\",target=\"new\">Open a new frame</a>\n\nYou may dispense with the dashes in front of the attribute names if you prefer:\n\nprint img {src=>'fred.gif',align=>'LEFT'};\n\n<img align=\"LEFT\" src=\"fred.gif\">\n\nSometimes an HTML tag attribute has no argument. For example, ordered lists can be marked as\nCOMPACT. The syntax for this is an argument that that points to an undef string:\n\nprint ol({compact=>undef},li('one'),li('two'),li('three'));\n\nPrior to CGI.pm version 2.41, providing an empty ('') string as an attribute argument was the\nsame as providing undef. However, this has changed in order to accommodate those who want to\ncreate tags of the form <img alt=\"\">. The difference is shown in these two pieces of code:\n\nCODE                   RESULT\nimg({alt=>undef})      <img alt>\nimg({alt=>''})         <img alt=\"\">\n"
                    },
                    {
                        "name": "The distributive property of HTML shortcuts",
                        "content": "One of the cool features of the HTML shortcuts is that they are distributive. If you give them\nan argument consisting of a reference to a list, the tag will be distributed across each element\nof the list. For example, here's one way to make an ordered list:\n\nprint ul(\nli({-type=>'disc'},['Sneezy','Doc','Sleepy','Happy'])\n);\n\nThis example will result in HTML output that looks like this:\n\n<ul>\n<li type=\"disc\">Sneezy</li>\n<li type=\"disc\">Doc</li>\n<li type=\"disc\">Sleepy</li>\n<li type=\"disc\">Happy</li>\n</ul>\n\nThis is extremely useful for creating tables. For example:\n\nprint table({-border=>undef},\ncaption('When Should You Eat Your Vegetables?'),\nTr({-align=>'CENTER',-valign=>'TOP'},\n[\nth(['Vegetable', 'Breakfast','Lunch','Dinner']),\ntd(['Tomatoes' , 'no', 'yes', 'yes']),\ntd(['Broccoli' , 'no', 'no',  'yes']),\ntd(['Onions'   , 'yes','yes', 'yes'])\n]\n)\n);\n\nHTML shortcuts and list interpolation\nConsider this bit of code:\n\nprint blockquote(em('Hi'),'mom!'));\n\nIt will ordinarily return the string that you probably expect, namely:\n\n<blockquote><em>Hi</em> mom!</blockquote>\n\nNote the space between the element \"Hi\" and the element \"mom!\". CGI.pm puts the extra space\nthere using array interpolation, which is controlled by the magic $\" variable. Sometimes this\nextra space is not what you want, for example, when you are trying to align a series of images.\nIn this case, you can simply change the value of $\" to an empty string.\n\n{\nlocal($\") = '';\nprint blockquote(em('Hi'),'mom!'));\n}\n\nI suggest you put the code in a block as shown here. Otherwise the change to $\" will affect all\nsubsequent code until you explicitly reset it.\n"
                    },
                    {
                        "name": "Non-standard HTML shortcuts",
                        "content": "A few HTML tags don't follow the standard pattern for various reasons.\n"
                    },
                    {
                        "name": "comment",
                        "content": "print comment('here is my comment');\n\nBecause of conflicts with built-in perl functions, the following functions begin with initial\ncaps:\n\nSelect\nTr\nLink\nDelete\nAccept\nSub\n\nIn addition, starthtml(), endhtml(), startform(), endform(), startmultipartform() and all\nthe fill-out form tags are special. See their respective sections.\n"
                    },
                    {
                        "name": "Autoescaping HTML",
                        "content": "By default, all HTML that is emitted by the form-generating functions is passed through a\nfunction called escapeHTML():\n\n$escapedstring = escapeHTML(\"unescaped string\");\nEscape HTML formatting characters in a string. Internally this calls HTML::Entities\n(encodeentities) so really you should just use that instead - the default list of chars\nthat will be encoded (passed to the HTML::Entities encodeentities method) is:\n\n& < > \" \\x8b \\x9b '\n\nyou can control this list by setting the value of $CGI::ENCODEENTITIES:\n\n# only encode < >\n$CGI::ENCODEENTITIES = q{<>}\n\nif you want to encode all entities then undef $CGI::ENCODEENTITIES:\n\n# encode all entities\n$CGI::ENCODEENTITIES = undef;\n\nThe automatic escaping does not apply to other shortcuts, such as h1(). You should call"
                    },
                    {
                        "name": "escapeHTML",
                        "content": "people may enter into guestbooks, etc.. To change the character set, use charset(). To turn\nautoescaping off completely, use autoEscape(0):\n\n$charset = charset([$charset]);\nGet or set the current character set.\n\n$flag = autoEscape([$flag]);\nGet or set the value of the autoescape flag.\n\nCREATING FILL-OUT FORMS:\n*General note* The various form-creating methods all return strings to the caller, containing\nthe tag or tags that will create the requested form element. You are responsible for actually\nprinting out these strings. It's set up this way so that you can place formatting tags around\nthe form elements.\n\n*Another note* The default values that you specify for the forms are only used the first time\nthe script is invoked (when there is no query string). On subsequent invocations of the script\n(when there is a query string), the former values are used even if they are blank.\n\nIf you want to change the value of a field from its previous value, you have two choices:\n\n(1) call the param() method to set it.\n\n(2) use the -override (alias -force) parameter (a new feature in version 2.15). This forces the\ndefault value to be used, regardless of the previous value:\n\nprint textfield(-name=>'fieldname',\n-default=>'starting value',\n-override=>1,\n-size=>50,\n-maxlength=>80);\n\n*Yet another note* By default, the text and labels of form elements are escaped according to\nHTML rules. This means that you can safely use \"<CLICK ME>\" as the label for a button. However,\nit also interferes with your ability to incorporate special HTML character sequences, such as\n&Aacute;, into your fields. If you wish to turn off automatic escaping, call the autoEscape()\nmethod with a false value immediately after creating the CGI object:\n\n$q = CGI->new;\n$q->autoEscape(0);\n\nNote that autoEscape() is exclusively used to effect the behavior of how some CGI.pm HTML\ngeneration functions handle escaping. Calling escapeHTML() explicitly will always escape the\nHTML.\n\n*A Lurking Trap!* Some of the form-element generating methods return multiple tags. In a scalar\ncontext, the tags will be concatenated together with spaces, or whatever is the current value of\nthe $\" global. In a list context, the methods will return a list of elements, allowing you to\nmodify them if you wish. Usually you will not notice this behavior, but beware of this:\n\nprintf(\"%s\\n\",endform())\n"
                    },
                    {
                        "name": "end_form",
                        "content": "only expects one value.\n\n<p>\n"
                    },
                    {
                        "name": "Creating an isindex tag",
                        "content": "print isindex(-action=>$action);\n\n-or-\n\nprint isindex($action);\n\nPrints out an <isindex> tag. Not very exciting. The parameter -action specifies the URL of the\nscript to process the query. The default is to process the query with the current script.\n"
                    },
                    {
                        "name": "Starting and ending a form",
                        "content": "print startform(-method=>$method,\n-action=>$action,\n-enctype=>$encoding);\n<... various form stuff ...>\nprint endform;\n\n-or-\n\nprint startform($method,$action,$encoding);\n<... various form stuff ...>\nprint endform;\n"
                    },
                    {
                        "name": "start_form",
                        "content": "you specify. The defaults are:\n\nmethod: POST\naction: this script\nenctype: application/x-www-form-urlencoded for non-XHTML\nmultipart/form-data for XHTML, see multipart/form-data below.\n"
                    },
                    {
                        "name": "end_form",
                        "content": ""
                    },
                    {
                        "name": "start_form",
                        "content": "before sending the form to the server. Two values are possible:\n\napplication/x-www-form-urlencoded\nThis is the older type of encoding. It is compatible with many CGI scripts and is suitable\nfor short fields containing text data. For your convenience, CGI.pm stores the name of this\nencoding type in &CGI::URLENCODED.\n\nmultipart/form-data\nThis is the newer type of encoding. It is suitable for forms that contain very large fields\nor that are intended for transferring binary data. Most importantly, it enables the \"file\nupload\" feature. For your convenience, CGI.pm stores the name of this encoding type in\n&CGI::MULTIPART\n\nForms that use this type of encoding are not easily interpreted by CGI scripts unless they\nuse CGI.pm or another library designed to handle them.\n\nIf XHTML is activated (the default), then forms will be automatically created using this\ntype of encoding.\n\nThe startform() method uses the older form of encoding by default unless XHTML is requested. If\nyou want to use the newer form of encoding by default, you can call startmultipartform()\ninstead of startform(). The method endmultipartform() is an alias to endform().\n\nJAVASCRIPTING: The -name and -onSubmit parameters are provided for use with JavaScript. The\n-name parameter gives the form a name so that it can be identified and manipulated by JavaScript\nfunctions. -onSubmit should point to a JavaScript function that will be executed just before the\nform is submitted to your server. You can use this opportunity to check the contents of the form\nfor consistency and completeness. If you find something wrong, you can put up an alert box or\nmaybe fix things up yourself. You can abort the submission by returning false from this\nfunction.\n\nUsually the bulk of JavaScript functions are defined in a <script> block in the HTML header and\n-onSubmit points to one of these function call. See starthtml() for details.\n"
                    },
                    {
                        "name": "Form elements",
                        "content": "After starting a form, you will typically create one or more textfields, popup menus, radio\ngroups and other form elements. Each of these elements takes a standard set of named arguments.\nSome elements also have optional arguments. The standard arguments are as follows:\n"
                    },
                    {
                        "name": "-name",
                        "content": "The name of the field. After submission this name can be used to retrieve the field's value\nusing the param() method.\n"
                    },
                    {
                        "name": "-value, -values",
                        "content": "The initial value of the field which will be returned to the script after form submission.\nSome form elements, such as text fields, take a single scalar -value argument. Others, such\nas popup menus, take a reference to an array of values. The two arguments are synonyms.\n"
                    },
                    {
                        "name": "-tabindex",
                        "content": "A numeric value that sets the order in which the form element receives focus when the user\npresses the tab key. Elements with lower values receive focus first.\n\n-id A string identifier that can be used to identify this element to JavaScript and DHTML.\n"
                    },
                    {
                        "name": "-override",
                        "content": "A boolean, which, if true, forces the element to take on the value specified by -value,\noverriding the sticky behavior described earlier for the -nosticky pragma.\n"
                    },
                    {
                        "name": "-onChange, -onFocus, -onBlur, -onMouseOver, -onMouseOut, -onSelect",
                        "content": "These are used to assign JavaScript event handlers. See the JavaScripting section for more\ndetails.\n\nOther common arguments are described in the next section. In addition to these, all attributes\ndescribed in the HTML specifications are supported.\n"
                    },
                    {
                        "name": "Creating a text field",
                        "content": "print textfield(-name=>'fieldname',\n-value=>'starting value',\n-size=>50,\n-maxlength=>80);\n-or-\n\nprint textfield('fieldname','starting value',50,80);\n"
                    },
                    {
                        "name": "textfield",
                        "content": "Parameters\n\n1.  The first parameter is the required name for the field (-name).\n\n2.  The optional second parameter is the default starting value for the field contents (-value,\nformerly known as -default).\n\n3.  The optional third parameter is the size of the field in characters (-size).\n\n4.  The optional fourth parameter is the maximum number of characters the field will accept\n(-maxlength).\n\nAs with all these methods, the field will be initialized with its previous contents from earlier\ninvocations of the script. When the form is processed, the value of the text field can be\nretrieved with:\n\n$value = param('foo');\n\nIf you want to reset it from its initial value after the script has been called once, you can do\nso like this:\n\nparam('foo',\"I'm taking over this value!\");\n"
                    },
                    {
                        "name": "Creating a big text field",
                        "content": "print textarea(-name=>'foo',\n-default=>'starting value',\n-rows=>10,\n-columns=>50);\n\n-or\n\nprint textarea('foo','starting value',10,50);\n"
                    },
                    {
                        "name": "textarea",
                        "content": "text entry box. You can provide a starting value for the field, which can be long and contain\nmultiple lines.\n"
                    },
                    {
                        "name": "Creating a password field",
                        "content": "print passwordfield(-name=>'secret',\n-value=>'starting value',\n-size=>50,\n-maxlength=>80);\n-or-\n\nprint passwordfield('secret','starting value',50,80);\n"
                    },
                    {
                        "name": "password_field",
                        "content": "the web page.\n"
                    },
                    {
                        "name": "Creating a file upload field",
                        "content": "print filefield(-name=>'uploadedfile',\n-default=>'starting value',\n-size=>50,\n-maxlength=>80);\n-or-\n\nprint filefield('uploadedfile','starting value',50,80);\n"
                    },
                    {
                        "name": "filefield",
                        "content": "use the new multipart encoding scheme* for the form. You can do this either by calling"
                    },
                    {
                        "name": "start_form",
                        "content": ""
                    },
                    {
                        "name": "start_multipart_form",
                        "content": "Parameters\n\n1.  The first parameter is the required name for the field (-name).\n\n2.  The optional second parameter is the starting value for the field contents to be used as the\ndefault file name (-default).\n\nFor security reasons, browsers don't pay any attention to this field, and so the starting\nvalue will always be blank. Worse, the field loses its \"sticky\" behavior and forgets its\nprevious contents. The starting value field is called for in the HTML specification,\nhowever, and possibly some browser will eventually provide support for it.\n\n3.  The optional third parameter is the size of the field in characters (-size).\n\n4.  The optional fourth parameter is the maximum number of characters the field will accept\n(-maxlength).\n\nJAVASCRIPTING: The -onChange, -onFocus, -onBlur, -onMouseOver, -onMouseOut and -onSelect\nparameters are recognized. See textfield() for details.\n"
                    },
                    {
                        "name": "Creating a popup menu",
                        "content": "print popupmenu('menuname',\n['eenie','meenie','minie'],\n'meenie');\n\n-or-\n\n%labels = ('eenie'=>'your first choice',\n'meenie'=>'your second choice',\n'minie'=>'your third choice');\n%attributes = ('eenie'=>{'class'=>'class of first choice'});\nprint popupmenu('menuname',\n['eenie','meenie','minie'],\n'meenie',\\%labels,\\%attributes);\n\n-or (named parameter style)-\n\nprint popupmenu(-name=>'menuname',\n-values=>['eenie','meenie','minie'],\n-default=>['meenie','minie'],\n-labels=>\\%labels,\n-attributes=>\\%attributes);\n"
                    },
                    {
                        "name": "popup_menu",
                        "content": "use scrollinglist() if you want to create a menu that supports multiple selections\n\n1.  The required first argument is the menu's name (-name).\n\n2.  The required second argument (-values) is an array reference containing the list of menu\nitems in the menu. You can pass the method an anonymous array, as shown in the example, or a\nreference to a named array, such as \"\\@foo\".\n\n3.  The optional third parameter (-default) is the name of the default menu choice. If not\nspecified, the first item will be the default. The values of the previous choice will be\nmaintained across queries. Pass an array reference to select multiple defaults.\n\n4.  The optional fourth parameter (-labels) is provided for people who want to use different\nvalues for the user-visible label inside the popup menu and the value returned to your\nscript. It's a pointer to an hash relating menu values to user-visible labels. If you leave\nthis parameter blank, the menu values will be displayed by default. (You can also leave a\nlabel undefined if you want to).\n\n5.  The optional fifth parameter (-attributes) is provided to assign any of the common HTML\nattributes to an individual menu item. It's a pointer to a hash relating menu values to\nanother hash with the attribute's name as the key and the attribute's value as the value.\n\nWhen the form is processed, the selected value of the popup menu can be retrieved using:\n\n$popupmenuvalue = param('menuname');\n"
                    },
                    {
                        "name": "Creating an option group",
                        "content": "Named parameter style\n\nprint popupmenu(-name=>'menuname',\n-values=>[qw/eenie meenie minie/,\noptgroup(-name=>'optgroupname',\n-values => ['moe','catch'],\n-attributes=>{'catch'=>{'class'=>'red'}})],\n-labels=>{'eenie'=>'one',\n'meenie'=>'two',\n'minie'=>'three'},\n-default=>'meenie');\n\nOld style\nprint popupmenu('menuname',\n['eenie','meenie','minie',\noptgroup('optgroupname', ['moe', 'catch'],\n{'catch'=>{'class'=>'red'}})],'meenie',\n{'eenie'=>'one','meenie'=>'two','minie'=>'three'});\n"
                    },
                    {
                        "name": "optgroup",
                        "content": "1.  The required first argument (-name) is the label attribute of the optgroup and is not\ninserted in the parameter list of the query.\n\n2.  The required second argument (-values) is an array reference containing the list of menu\nitems in the menu. You can pass the method an anonymous array, as shown in the example, or a\nreference to a named array, such as \\@foo. If you pass a HASH reference, the keys will be\nused for the menu values, and the values will be used for the menu labels (see -labels\nbelow).\n\n3.  The optional third parameter (-labels) allows you to pass a reference to a hash containing\nuser-visible labels for one or more of the menu items. You can use this when you want the\nuser to see one menu string, but have the browser return your program a different one. If\nyou don't specify this, the value string will be used instead (\"eenie\", \"meenie\" and \"minie\"\nin this example). This is equivalent to using a hash reference for the -values parameter.\n\n4.  An optional fourth parameter (-labeled) can be set to a true value and indicates that the\nvalues should be used as the label attribute for each option element within the optgroup.\n\n5.  An optional fifth parameter (-novals) can be set to a true value and indicates to suppress\nthe val attribute in each option element within the optgroup.\n\nSee the discussion on optgroup at W3C\n(http://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTGROUP) for details.\n\n6.  An optional sixth parameter (-attributes) is provided to assign any of the common HTML\nattributes to an individual menu item. It's a pointer to a hash relating menu values to\nanother hash with the attribute's name as the key and the attribute's value as the value.\n"
                    },
                    {
                        "name": "Creating a scrolling list",
                        "content": "print scrollinglist('listname',\n['eenie','meenie','minie','moe'],\n['eenie','moe'],5,'true',{'moe'=>{'class'=>'red'}});\n-or-\n\nprint scrollinglist('listname',\n['eenie','meenie','minie','moe'],\n['eenie','moe'],5,'true',\n\\%labels,%attributes);\n\n-or-\n\nprint scrollinglist(-name=>'listname',\n-values=>['eenie','meenie','minie','moe'],\n-default=>['eenie','moe'],\n-size=>5,\n-multiple=>'true',\n-labels=>\\%labels,\n-attributes=>\\%attributes);\n"
                    },
                    {
                        "name": "scrolling_list",
                        "content": "Parameters:\n\n1.  The first and second arguments are the list name (-name) and values (-values). As in the\npopup menu, the second argument should be an array reference.\n\n2.  The optional third argument (-default) can be either a reference to a list containing the\nvalues to be selected by default, or can be a single value to select. If this argument is\nmissing or undefined, then nothing is selected when the list first appears. In the named\nparameter version, you can use the synonym \"-defaults\" for this parameter.\n\n3.  The optional fourth argument is the size of the list (-size).\n\n4.  The optional fifth argument can be set to true to allow multiple simultaneous selections\n(-multiple). Otherwise only one selection will be allowed at a time.\n\n5.  The optional sixth argument is a pointer to a hash containing long user-visible labels for\nthe list items (-labels). If not provided, the values will be displayed.\n\n6.  The optional sixth parameter (-attributes) is provided to assign any of the common HTML\nattributes to an individual menu item. It's a pointer to a hash relating menu values to\nanother hash with the attribute's name as the key and the attribute's value as the value.\n\nWhen this form is processed, all selected list items will be returned as a list under the\nparameter name 'listname'. The values of the selected items can be retrieved with:\n\n@selected = param('listname');\n"
                    },
                    {
                        "name": "Creating a group of related checkboxes",
                        "content": "print checkboxgroup(-name=>'groupname',\n-values=>['eenie','meenie','minie','moe'],\n-default=>['eenie','moe'],\n-linebreak=>'true',\n-disabled => ['moe'],\n-labels=>\\%labels,\n-attributes=>\\%attributes);\n\nprint checkboxgroup('groupname',\n['eenie','meenie','minie','moe'],\n['eenie','moe'],'true',\\%labels,\n{'moe'=>{'class'=>'red'}});\n\nHTML3-COMPATIBLE BROWSERS ONLY:\n\nprint checkboxgroup(-name=>'groupname',\n-values=>['eenie','meenie','minie','moe'],\n-rows=2,-columns=>2);\n"
                    },
                    {
                        "name": "checkbox_group",
                        "content": "Parameters:\n\n1.  The first and second arguments are the checkbox name and values, respectively (-name and\n-values). As in the popup menu, the second argument should be an array reference. These\nvalues are used for the user-readable labels printed next to the checkboxes as well as for\nthe values passed to your script in the query string.\n\n2.  The optional third argument (-default) can be either a reference to a list containing the\nvalues to be checked by default, or can be a single value to checked. If this argument is\nmissing or undefined, then nothing is selected when the list first appears.\n\n3.  The optional fourth argument (-linebreak) can be set to true to place line breaks between\nthe checkboxes so that they appear as a vertical list. Otherwise, they will be strung\ntogether on a horizontal line.\n\nThe optional -labels argument is a pointer to a hash relating the checkbox values to the\nuser-visible labels that will be printed next to them. If not provided, the values will be used\nas the default.\n\nThe optional parameters -rows, and -columns cause checkboxgroup() to return an HTML3 compatible\ntable containing the checkbox group formatted with the specified number of rows and columns. You\ncan provide just the -columns parameter if you wish; checkboxgroup will calculate the correct\nnumber of rows for you.\n\nThe option -disabled takes an array of checkbox values and disables them by greying them out\n(this may not be supported by all browsers).\n\nThe optional -attributes argument is provided to assign any of the common HTML attributes to an\nindividual menu item. It's a pointer to a hash relating menu values to another hash with the\nattribute's name as the key and the attribute's value as the value.\n\nThe optional -tabindex argument can be used to control the order in which radio buttons receive\nfocus when the user presses the tab button. If passed a scalar numeric value, the first element\nin the group will receive this tab index and subsequent elements will be incremented by one. If\ngiven a reference to an array of radio button values, then the indexes will be jiggered so that\nthe order specified in the array will correspond to the tab order. You can also pass a reference\nto a hash in which the hash keys are the radio button values and the values are the tab indexes\nof each button. Examples:\n\n-tabindex => 100    #  this group starts at index 100 and counts up\n-tabindex => ['moe','minie','eenie','meenie']  # tab in this order\n-tabindex => {meenie=>100,moe=>101,minie=>102,eenie=>200} # tab in this order\n\nThe optional -labelattributes argument will contain attributes attached to the <label> element\nthat surrounds each button.\n\nWhen the form is processed, all checked boxes will be returned as a list under the parameter\nname 'groupname'. The values of the \"on\" checkboxes can be retrieved with:\n\n@turnedon = param('groupname');\n\nThe value returned by checkboxgroup() is actually an array of button elements. You can capture\nthem and use them within tables, lists, or in other creative ways:\n\n@h = checkboxgroup(-name=>'groupname',-values=>\\@values);\n&useincreativeway(@h);\n"
                    },
                    {
                        "name": "Creating a standalone checkbox",
                        "content": "print checkbox(-name=>'checkboxname',\n-checked=>1,\n-value=>'ON',\n-label=>'CLICK ME');\n\n-or-\n\nprint checkbox('checkboxname','checked','ON','CLICK ME');\n"
                    },
                    {
                        "name": "checkbox",
                        "content": "Parameters:\n\n1.  The first parameter is the required name for the checkbox (-name). It will also be used for\nthe user-readable label printed next to the checkbox.\n\n2.  The optional second parameter (-checked) specifies that the checkbox is turned on by\ndefault. Synonyms are -selected and -on.\n\n3.  The optional third parameter (-value) specifies the value of the checkbox when it is\nchecked. If not provided, the word \"on\" is assumed.\n\n4.  The optional fourth parameter (-label) is the user-readable label to be attached to the\ncheckbox. If not provided, the checkbox name is used.\n\nThe value of the checkbox can be retrieved using:\n\n$turnedon = param('checkboxname');\n"
                    },
                    {
                        "name": "Creating a radio button group",
                        "content": "print radiogroup(-name=>'groupname',\n-values=>['eenie','meenie','minie'],\n-default=>'meenie',\n-linebreak=>'true',\n-labels=>\\%labels,\n-attributes=>\\%attributes);\n\n-or-\n\nprint radiogroup('groupname',['eenie','meenie','minie'],\n'meenie','true',\\%labels,\\%attributes);\n\n\nHTML3-COMPATIBLE BROWSERS ONLY:\n\nprint radiogroup(-name=>'groupname',\n-values=>['eenie','meenie','minie','moe'],\n-rows=2,-columns=>2);\n"
                    },
                    {
                        "name": "radio_group",
                        "content": "on turns the others off)\n\nParameters:\n\n1.  The first argument is the name of the group and is required (-name).\n\n2.  The second argument (-values) is the list of values for the radio buttons. The values and\nthe labels that appear on the page are identical. Pass an array *reference* in the second\nargument, either using an anonymous array, as shown, or by referencing a named array as in\n\"\\@foo\".\n\n3.  The optional third parameter (-default) is the name of the default button to turn on. If not\nspecified, the first item will be the default. You can provide a nonexistent button name,\nsuch as \"-\" to start up with no buttons selected.\n\n4.  The optional fourth parameter (-linebreak) can be set to 'true' to put line breaks between\nthe buttons, creating a vertical list.\n\n5.  The optional fifth parameter (-labels) is a pointer to an associative array relating the\nradio button values to user-visible labels to be used in the display. If not provided, the\nvalues themselves are displayed.\n\nAll modern browsers can take advantage of the optional parameters -rows, and -columns. These\nparameters cause radiogroup() to return an HTML3 compatible table containing the radio group\nformatted with the specified number of rows and columns. You can provide just the -columns\nparameter if you wish; radiogroup will calculate the correct number of rows for you.\n\nTo include row and column headings in the returned table, you can use the -rowheaders and\n-colheaders parameters. Both of these accept a pointer to an array of headings to use. The\nheadings are just decorative. They don't reorganize the interpretation of the radio buttons --\nthey're still a single named unit.\n\nThe optional -tabindex argument can be used to control the order in which radio buttons receive\nfocus when the user presses the tab button. If passed a scalar numeric value, the first element\nin the group will receive this tab index and subsequent elements will be incremented by one. If\ngiven a reference to an array of radio button values, then the indexes will be jiggered so that\nthe order specified in the array will correspond to the tab order. You can also pass a reference\nto a hash in which the hash keys are the radio button values and the values are the tab indexes\nof each button. Examples:\n\n-tabindex => 100    #  this group starts at index 100 and counts up\n-tabindex => ['moe','minie','eenie','meenie']  # tab in this order\n-tabindex => {meenie=>100,moe=>101,minie=>102,eenie=>200} # tab in this order\n\nThe optional -attributes argument is provided to assign any of the common HTML attributes to an\nindividual menu item. It's a pointer to a hash relating menu values to another hash with the\nattribute's name as the key and the attribute's value as the value.\n\nThe optional -labelattributes argument will contain attributes attached to the <label> element\nthat surrounds each button.\n\nWhen the form is processed, the selected radio button can be retrieved using:\n\n$whichradiobutton = param('groupname');\n\nThe value returned by radiogroup() is actually an array of button elements. You can capture\nthem and use them within tables, lists, or in other creative ways:\n\n@h = radiogroup(-name=>'groupname',-values=>\\@values);\n&useincreativeway(@h);\n"
                    },
                    {
                        "name": "Creating a submit button",
                        "content": "print submit(-name=>'buttonname',\n-value=>'value');\n\n-or-\n\nprint submit('buttonname','value');\n"
                    },
                    {
                        "name": "submit",
                        "content": "Parameters:\n\n1.  The first argument (-name) is optional. You can give the button a name if you have several\nsubmission buttons in your form and you want to distinguish between them.\n\n2.  The second argument (-value) is also optional. This gives the button a value that will be\npassed to your script in the query string. The name will also be used as the user-visible\nlabel.\n\n3.  You can use -label as an alias for -value. I always get confused about which of -name and\n-value changes the user-visible label on the button.\n\nYou can figure out which button was pressed by using different values for each one:\n\n$whichone = param('buttonname');\n"
                    },
                    {
                        "name": "Creating a reset button",
                        "content": "print reset\n"
                    },
                    {
                        "name": "reset",
                        "content": "time the script was called, NOT necessarily to the defaults.\n\nNote that this conflicts with the perl reset() built-in. Use CORE::reset() to get the original\nreset function.\n"
                    },
                    {
                        "name": "Creating a default button",
                        "content": "print defaults('buttonlabel')\n"
                    },
                    {
                        "name": "defaults",
                        "content": "its defaults, wiping out all the changes the user ever made.\n"
                    },
                    {
                        "name": "Creating a hidden field",
                        "content": "print hidden(-name=>'hiddenname',\n-default=>['value1','value2'...]);\n\n-or-\n\nprint hidden('hiddenname','value1','value2'...);\n"
                    },
                    {
                        "name": "hidden",
                        "content": "variable information from one invocation of the script to the next.\n\nParameters:\n\n1.  The first argument is required and specifies the name of this field (-name).\n\n2.\nThe second argument is also required and specifies its value (-default). In the named\nparameter style of calling, you can provide a single value here or a reference to a whole\nlist\n\nFetch the value of a hidden field this way:\n\n$hiddenvalue = param('hiddenname');\n\nNote, that just like all the other form elements, the value of a hidden field is \"sticky\". If\nyou want to replace a hidden field with some other values after the script has been called once\nyou'll have to do it manually:\n\nparam('hiddenname','new','values','here');\n"
                    },
                    {
                        "name": "Creating a clickable image button",
                        "content": "print imagebutton(-name=>'buttonname',\n-src=>'/source/URL',\n-align=>'MIDDLE');\n\n-or-\n\nprint imagebutton('buttonname','/source/URL','MIDDLE');\n"
                    },
                    {
                        "name": "image_button",
                        "content": "returned to your script as \"buttonname.x\" and \"buttonname.y\", where \"buttonname\" is the name\nyou've assigned to it.\n\nParameters:\n\n1.  The first argument (-name) is required and specifies the name of this field.\n\n2.  The second argument (-src) is also required and specifies the URL\n\n3.  The third option (-align, optional) is an alignment type, and may be TOP, BOTTOM or MIDDLE\n\nFetch the value of the button this way: $x = param('buttonname.x'); $y ="
                    },
                    {
                        "name": "param",
                        "content": ""
                    },
                    {
                        "name": "Creating a javascript action button",
                        "content": "print button(-name=>'buttonname',\n-value=>'user visible label',\n-onClick=>\"dosomething()\");\n\n-or-\n\nprint button('buttonname',\"user visible value\",\"dosomething()\");\n"
                    },
                    {
                        "name": "button",
                        "content": "JavaScript code pointed to by the -onClick parameter will be executed.\n"
                    }
                ]
            },
            "WORKING WITH FRAMES": {
                "content": "It's possible for CGI.pm scripts to write into several browser panels and windows using the HTML\n4 frame mechanism. There are three techniques for defining new frames programmatically:\n\n1. Create a <Frameset> document\nAfter writing out the HTTP header, instead of creating a standard HTML document using the\nstarthtml() call, create a <frameset> document that defines the frames on the page. Specify\nyour script(s) (with appropriate parameters) as the SRC for each of the frames.\n\nThere is no specific support for creating <frameset> sections in CGI.pm, but the HTML is\nvery simple to write.\n\n2. Specify the destination for the document in the HTTP header\nYou may provide a -target parameter to the header() method:\n\nprint header(-target=>'ResultsWindow');\n\nThis will tell the browser to load the output of your script into the frame named\n\"ResultsWindow\". If a frame of that name doesn't already exist, the browser will pop up a\nnew window and load your script's document into that. There are a number of magic names that\nyou can use for targets. See the HTML \"<frame>\" documentation for details.\n\n3. Specify the destination for the document in the <form> tag\nYou can specify the frame to load in the FORM tag itself. With CGI.pm it looks like this:\n\nprint startform(-target=>'ResultsWindow');\n\nWhen your script is reinvoked by the form, its output will be loaded into the frame named\n\"ResultsWindow\". If one doesn't already exist a new window will be created.\n\nThe script \"frameset.cgi\" in the examples directory shows one way to create pages in which the\nfill-out form and the response live in side-by-side frames.\n",
                "subsections": []
            },
            "SUPPORT FOR JAVASCRIPT": {
                "content": "The usual way to use JavaScript is to define a set of functions in a <SCRIPT> block inside the\nHTML header and then to register event handlers in the various elements of the page. Events\ninclude such things as the mouse passing over a form element, a button being clicked, the\ncontents of a text field changing, or a form being submitted. When an event occurs that involves\nan element that has registered an event handler, its associated JavaScript code gets called.\n\nThe elements that can register event handlers include the <BODY> of an HTML document, hypertext\nlinks, all the various elements of a fill-out form, and the form itself. There are a large\nnumber of events, and each applies only to the elements for which it is relevant. Here is a\npartial list:\n\nonLoad\nThe browser is loading the current document. Valid in:\n\n+ The HTML <BODY> section only.\n\nonUnload\nThe browser is closing the current page or frame. Valid for:\n\n+ The HTML <BODY> section only.\n\nonSubmit\nThe user has pressed the submit button of a form. This event happens just before the form is\nsubmitted, and your function can return a value of false in order to abort the submission.\nValid for:\n\n+ Forms only.\n\nonClick\nThe mouse has clicked on an item in a fill-out form. Valid for:\n\n+ Buttons (including submit, reset, and image buttons)\n+ Checkboxes\n+ Radio buttons\n\nonChange\nThe user has changed the contents of a field. Valid for:\n\n+ Text fields\n+ Text areas\n+ Password fields\n+ File fields\n+ Popup Menus\n+ Scrolling lists\n\nonFocus\nThe user has selected a field to work with. Valid for:\n\n+ Text fields\n+ Text areas\n+ Password fields\n+ File fields\n+ Popup Menus\n+ Scrolling lists\n\nonBlur\nThe user has deselected a field (gone to work somewhere else). Valid for:\n\n+ Text fields\n+ Text areas\n+ Password fields\n+ File fields\n+ Popup Menus\n+ Scrolling lists\n\nonSelect\nThe user has changed the part of a text field that is selected. Valid for:\n\n+ Text fields\n+ Text areas\n+ Password fields\n+ File fields\n\nonMouseOver\nThe mouse has moved over an element.\n\n+ Text fields\n+ Text areas\n+ Password fields\n+ File fields\n+ Popup Menus\n+ Scrolling lists\n\nonMouseOut\nThe mouse has moved off an element.\n\n+ Text fields\n+ Text areas\n+ Password fields\n+ File fields\n+ Popup Menus\n+ Scrolling lists\n\nIn order to register a JavaScript event handler with an HTML element, just use the event name as\na parameter when you call the corresponding CGI method. For example, to have your validateAge()\nJavaScript code executed every time the textfield named \"age\" changes, generate the field like\nthis:\n\nprint textfield(-name=>'age',-onChange=>\"validateAge(this)\");\n\nThis example assumes that you've already declared the validateAge() function by incorporating it\ninto a <SCRIPT> block. The CGI.pm starthtml() method provides a convenient way to create this\nsection.\n\nSimilarly, you can create a form that checks itself over for consistency and alerts the user if\nsome essential value is missing by creating it this way: print",
                "subsections": [
                    {
                        "name": "start_form",
                        "content": "See the javascript.cgi script for a demonstration of how this all works.\n"
                    }
                ]
            },
            "LIMITED SUPPORT FOR CASCADING STYLE SHEETS": {
                "content": "CGI.pm has limited support for HTML3's cascading style sheets (css). To incorporate a stylesheet\ninto your document, pass the starthtml() method a -style parameter. The value of this parameter\nmay be a scalar, in which case it is treated as the source URL for the stylesheet, or it may be\na hash reference. In the latter case you should provide the hash with one or more of -src or\n-code. -src points to a URL where an externally-defined stylesheet can be found. -code points to\na scalar value to be incorporated into a <style> section. Style definitions in -code override\nsimilarly-named ones in -src, hence the name \"cascading.\"\n\nYou may also specify the type of the stylesheet by adding the optional -type parameter to the\nhash pointed to by -style. If not specified, the style defaults to 'text/css'.\n\nTo refer to a style within the body of your document, add the -class parameter to any HTML\nelement:\n\nprint h1({-class=>'Fancy'},'Welcome to the Party');\n\nOr define styles on the fly with the -style parameter:\n\nprint h1({-style=>'Color: red;'},'Welcome to Hell');\n\nYou may also use the new span() element to apply a style to a section of text:\n\nprint span({-style=>'Color: red;'},\nh1('Welcome to Hell'),\n\"Where did that handbasket get to?\"\n);\n\nNote that you must import the \":html3\" definitions to have the span() method available. Here's a\nquick and dirty example of using CSS's. See the CSS specification at\nhttp://www.w3.org/Style/CSS/ for more information.\n\nuse CGI qw/:standard :html3/;\n\n#here's a stylesheet incorporated directly into the page\n$newStyle=<<END;\n<!--\nP.Tip {\nmargin-right: 50pt;\nmargin-left: 50pt;\ncolor: red;\n}\nP.Alert {\nfont-size: 30pt;\nfont-family: sans-serif;\ncolor: red;\n}\n-->\nEND\nprint header();\nprint starthtml( -title=>'CGI with Style',\n-style=>{-src=>'http://www.capricorn.com/style/st1.css',\n-code=>$newStyle}\n);\nprint h1('CGI with Style'),\np({-class=>'Tip'},\n\"Better read the cascading style sheet spec before playing with this!\"),\nspan({-style=>'color: magenta'},\n\"Look Mom, no hands!\",\np(),\n\"Whooo wee!\"\n);\nprint endhtml;\n\nPass an array reference to -code or -src in order to incorporate multiple stylesheets into your\ndocument.\n\nShould you wish to incorporate a verbatim stylesheet that includes arbitrary formatting in the\nheader, you may pass a -verbatim tag to the -style hash, as follows:\n\nprint starthtml (-style => {-verbatim => '@import url(\"/server-common/css/'.$cssFile.'\");',\n-src => '/server-common/css/core.css'});\n\nThis will generate an HTML header that contains this:\n\n<link rel=\"stylesheet\" type=\"text/css\"  href=\"/server-common/css/core.css\">\n<style type=\"text/css\">\n@import url(\"/server-common/css/main.css\");\n</style>\n\nAny additional arguments passed in the -style value will be incorporated into the <link> tag.\nFor example:\n\nstarthtml(-style=>{-src=>['/styles/print.css','/styles/layout.css'],\n-media => 'all'});\n\nThis will give:\n\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/print.css\" media=\"all\"/>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/layout.css\" media=\"all\"/>\n\n<p>\n\nTo make more complicated <link> tags, use the Link() function and pass it to starthtml() in the\n-head argument, as in:\n\n@h = (Link({-rel=>'stylesheet',-type=>'text/css',-src=>'/ss/ss.css',-media=>'all'}),\nLink({-rel=>'stylesheet',-type=>'text/css',-src=>'/ss/fred.css',-media=>'paper'}));\nprint starthtml({-head=>\\@h})\n\nTo create primary and \"alternate\" stylesheet, use the -alternate option:\n\nstarthtml(-style=>{-src=>[\n{-src=>'/styles/print.css'},\n{-src=>'/styles/alt.css',-alternate=>1}\n]\n});\n\nDumping out all the name/value pairs\nThe Dump() method produces a string consisting of all the query's name/value pairs formatted\nnicely as a nested list. This is useful for debugging purposes:\n\nprint Dump\n\nProduces something that looks like:\n\n<ul>\n<li>name1\n<ul>\n<li>value1\n<li>value2\n</ul>\n<li>name2\n<ul>\n<li>value1\n</ul>\n</ul>\n\nAs a shortcut, you can interpolate the entire CGI object into a string and it will be replaced\nwith the a nice HTML dump shown above:\n\n$q=CGI->new;\nprint \"<h2>Current Values</h2> $q\\n\";\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Address bug reports and comments to: <https://github.com/leejo/CGI.pm/issues>\n\nSee the <https://github.com/leejo/CGI.pm/blob/master/CONTRIBUTING.md> file for information on\nraising issues and contributing\n\nThe original bug tracker can be found at:\n<https://rt.cpan.org/Public/Dist/Display.html?Queue=CGI.pm>\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "CGI - The original source of this documentation / functionality\n",
                "subsections": []
            }
        }
    }
}