{
    "content": [
        {
            "type": "text",
            "text": "# CGI::Simple (perldoc)\n\n## NAME\n\nCGI::Simple - A Simple totally OO CGI interface that is CGI.pm compliant\n\n## SYNOPSIS\n\nuse CGI::Simple;\n$CGI::Simple::POSTMAX = 1024;       # max upload via post default 100kB\n$CGI::Simple::DISABLEUPLOADS = 0;   # enable uploads\n$q = CGI::Simple->new;\n$q = CGI::Simple->new( { 'foo'=>'1', 'bar'=>[2,3,4] } );\n$q = CGI::Simple->new( 'foo=1&bar=2&bar=3&bar=4' );\n$q = CGI::Simple->new( \\*FILEHANDLE );\n$q->save( \\*FILEHANDLE );   # save current object to a file as used by new\n@params = $q->param;        # return all param names as a list\n$value = $q->param('foo');  # return the first value supplied for 'foo'\n@values = $q->param('foo'); # return all values supplied for foo\n%fields   = $q->Vars;      # returns untied key value pair hash\n$hashref = $q->Vars;      # or as a hash ref\n%fields   = $q->Vars(\"|\"); # packs multiple values with \"|\" rather than \"\\0\";\n@keywords = $q->keywords;  # return all keywords as a list\n$q->param( 'foo', 'some', 'new', 'values' );      # set new 'foo' values\n$q->param( -name=>'foo', -value=>'bar' );\n$q->param( -name=>'foo', -value=>['bar','baz'] );\n$q->param( 'foo', 'some', 'new', 'values' );      # append values to 'foo'\n$q->append( -name=>'foo', -value=>'bar' );\n$q->append( -name=>'foo', -value=>['some', 'new', 'values'] );\n$q->delete('foo'); # delete param 'foo' and all its values\n$q->deleteall;    # delete everything\n<INPUT TYPE=\"file\" NAME=\"uploadfile\" SIZE=\"42\">\n$files    = $q->upload()                # number of files uploaded\n@files    = $q->upload();               # names of all uploaded files\n$filename = $q->param('uploadfile')    # filename of uploaded file\n$mime     = $q->uploadinfo($filename,'mime'); # MIME type of uploaded file\n$size     = $q->uploadinfo($filename,'size'); # size of uploaded file\nmy $fh = $q->upload($filename);         # get filehandle to read from\nwhile ( read( $fh, $buffer, 1024 ) ) { ... }\n# short and sweet upload\n$ok = $q->upload( $q->param('uploadfile'), '/path/to/write/file.name' );\nprint \"Uploaded \".$q->param('uploadfile').\" and wrote it OK!\" if $ok;\n$decoded    = $q->urldecode($encoded);\n$encoded    = $q->urlencode($unencoded);\n$escaped    = $q->escapeHTML('<>\"&');\n$unescaped  = $q->unescapeHTML('&lt;&gt;&quot;&amp;');\n$qs = $q->querystring; # get all data in $q as a query string OK for GET\n$q->nocache(1);        # set Pragma: no-cache + expires\nprint $q->header();     # print a simple header\n# get a complex header\n$header = $q->header(   -type       => 'image/gif'\n-nph        => 1,\n-status     => '402 Payment required',\n-expires    =>'+24h',\n-cookie     => $cookie,\n-charset    => 'utf-7',\n-attachment => 'foo.gif',\n-Cost       => '$2.00'\n);\n# a p3p header (OK for redirect use as well)\n$header = $q->header( -p3p => 'policyref=\"http://somesite.com/P3P/PolicyReferences.xml' );\n@cookies = $q->cookie();        # get names of all available cookies\n$value   = $q->cookie('foo')    # get first value of cookie 'foo'\n@value   = $q->cookie('foo')    # get all values of cookie 'foo'\n# get a cookie formatted for header() method\n$cookie  = $q->cookie(  -name    => 'Password',\n-values  => ['superuser','god','my dog woofie'],\n-expires => '+3d',\n-domain  => '.nowhere.com',\n-path    => '/cgi-bin/database',\n-secure  => 1\n);\nprint $q->header( -cookie=>$cookie );       # set cookie\nprint $q->redirect('http://go.away.now');   # print a redirect header\ndienice( $q->cgierror ) if $q->cgierror;\n\n## DESCRIPTION\n\nCGI::Simple provides a relatively lightweight drop in replacement for CGI.pm. It shares an\nidentical OO interface to CGI.pm for parameter parsing, file upload, cookie handling and header\ngeneration. This module is entirely object oriented, however a complete functional interface is\navailable by using the CGI::Simple::Standard module.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION** (6 subsections)\n- **THE CORE METHODS** (4 subsections)\n- **FILE UPLOADS** (1 subsections)\n- **MISCELANEOUS METHODS**\n- **HTTP COOKIES** (7 subsections)\n- **CREATING HTTP HEADERS** (2 subsections)\n- **PRAGMAS** (11 subsections)\n- **USING NPH SCRIPTS**\n- **SERVER PUSH** (1 subsections)\n- **DEBUGGING**\n- **ACCESSOR METHODS** (30 subsections)\n- **EXPORT**\n- **AUTHOR INFORMATION**\n- **CREDITS**\n- **LICENCE AND COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CGI::Simple",
        "section": "",
        "mode": "perldoc",
        "summary": "CGI::Simple - A Simple totally OO CGI interface that is CGI.pm compliant",
        "synopsis": "use CGI::Simple;\n$CGI::Simple::POSTMAX = 1024;       # max upload via post default 100kB\n$CGI::Simple::DISABLEUPLOADS = 0;   # enable uploads\n$q = CGI::Simple->new;\n$q = CGI::Simple->new( { 'foo'=>'1', 'bar'=>[2,3,4] } );\n$q = CGI::Simple->new( 'foo=1&bar=2&bar=3&bar=4' );\n$q = CGI::Simple->new( \\*FILEHANDLE );\n$q->save( \\*FILEHANDLE );   # save current object to a file as used by new\n@params = $q->param;        # return all param names as a list\n$value = $q->param('foo');  # return the first value supplied for 'foo'\n@values = $q->param('foo'); # return all values supplied for foo\n%fields   = $q->Vars;      # returns untied key value pair hash\n$hashref = $q->Vars;      # or as a hash ref\n%fields   = $q->Vars(\"|\"); # packs multiple values with \"|\" rather than \"\\0\";\n@keywords = $q->keywords;  # return all keywords as a list\n$q->param( 'foo', 'some', 'new', 'values' );      # set new 'foo' values\n$q->param( -name=>'foo', -value=>'bar' );\n$q->param( -name=>'foo', -value=>['bar','baz'] );\n$q->param( 'foo', 'some', 'new', 'values' );      # append values to 'foo'\n$q->append( -name=>'foo', -value=>'bar' );\n$q->append( -name=>'foo', -value=>['some', 'new', 'values'] );\n$q->delete('foo'); # delete param 'foo' and all its values\n$q->deleteall;    # delete everything\n<INPUT TYPE=\"file\" NAME=\"uploadfile\" SIZE=\"42\">\n$files    = $q->upload()                # number of files uploaded\n@files    = $q->upload();               # names of all uploaded files\n$filename = $q->param('uploadfile')    # filename of uploaded file\n$mime     = $q->uploadinfo($filename,'mime'); # MIME type of uploaded file\n$size     = $q->uploadinfo($filename,'size'); # size of uploaded file\nmy $fh = $q->upload($filename);         # get filehandle to read from\nwhile ( read( $fh, $buffer, 1024 ) ) { ... }\n# short and sweet upload\n$ok = $q->upload( $q->param('uploadfile'), '/path/to/write/file.name' );\nprint \"Uploaded \".$q->param('uploadfile').\" and wrote it OK!\" if $ok;\n$decoded    = $q->urldecode($encoded);\n$encoded    = $q->urlencode($unencoded);\n$escaped    = $q->escapeHTML('<>\"&');\n$unescaped  = $q->unescapeHTML('&lt;&gt;&quot;&amp;');\n$qs = $q->querystring; # get all data in $q as a query string OK for GET\n$q->nocache(1);        # set Pragma: no-cache + expires\nprint $q->header();     # print a simple header\n# get a complex header\n$header = $q->header(   -type       => 'image/gif'\n-nph        => 1,\n-status     => '402 Payment required',\n-expires    =>'+24h',\n-cookie     => $cookie,\n-charset    => 'utf-7',\n-attachment => 'foo.gif',\n-Cost       => '$2.00'\n);\n# a p3p header (OK for redirect use as well)\n$header = $q->header( -p3p => 'policyref=\"http://somesite.com/P3P/PolicyReferences.xml' );\n@cookies = $q->cookie();        # get names of all available cookies\n$value   = $q->cookie('foo')    # get first value of cookie 'foo'\n@value   = $q->cookie('foo')    # get all values of cookie 'foo'\n# get a cookie formatted for header() method\n$cookie  = $q->cookie(  -name    => 'Password',\n-values  => ['superuser','god','my dog woofie'],\n-expires => '+3d',\n-domain  => '.nowhere.com',\n-path    => '/cgi-bin/database',\n-secure  => 1\n);\nprint $q->header( -cookie=>$cookie );       # set cookie\nprint $q->redirect('http://go.away.now');   # print a redirect header\ndienice( $q->cgierror ) if $q->cgierror;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 86,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 15,
                "subsections": [
                    {
                        "name": "First you need to initialize an object",
                        "lines": 8
                    },
                    {
                        "name": "Next you call methods on that object",
                        "lines": 6
                    },
                    {
                        "name": "param",
                        "lines": 56
                    },
                    {
                        "name": "Selecting which methods to load",
                        "lines": 14
                    },
                    {
                        "name": "To Autoload or not to Autoload, that is the question.",
                        "lines": 14
                    },
                    {
                        "name": "Setting globals using the functional interface",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "THE CORE METHODS",
                "lines": 32,
                "subsections": [
                    {
                        "name": "restore_parameters",
                        "lines": 68
                    },
                    {
                        "name": "param",
                        "lines": 98
                    },
                    {
                        "name": "param",
                        "lines": 2
                    },
                    {
                        "name": "param",
                        "lines": 43
                    }
                ]
            },
            {
                "name": "FILE UPLOADS",
                "lines": 96,
                "subsections": [
                    {
                        "name": "param",
                        "lines": 38
                    }
                ]
            },
            {
                "name": "MISCELANEOUS METHODS",
                "lines": 37,
                "subsections": []
            },
            {
                "name": "HTTP COOKIES",
                "lines": 48,
                "subsections": [
                    {
                        "name": "cookie",
                        "lines": 1
                    },
                    {
                        "name": "-name",
                        "lines": 4
                    },
                    {
                        "name": "-value",
                        "lines": 7
                    },
                    {
                        "name": "-path",
                        "lines": 2
                    },
                    {
                        "name": "-domain",
                        "lines": 2
                    },
                    {
                        "name": "-expires",
                        "lines": 5
                    },
                    {
                        "name": "-secure",
                        "lines": 47
                    }
                ]
            },
            {
                "name": "CREATING HTTP HEADERS",
                "lines": 28,
                "subsections": [
                    {
                        "name": "header",
                        "lines": 116
                    },
                    {
                        "name": "no_cache",
                        "lines": 26
                    }
                ]
            },
            {
                "name": "PRAGMAS",
                "lines": 17,
                "subsections": [
                    {
                        "name": "-no_undef_params",
                        "lines": 6
                    },
                    {
                        "name": "-nph",
                        "lines": 4
                    },
                    {
                        "name": "-newstyle_urls",
                        "lines": 8
                    },
                    {
                        "name": "-oldstyle_urls",
                        "lines": 5
                    },
                    {
                        "name": "-autoload",
                        "lines": 3
                    },
                    {
                        "name": "-no_debug",
                        "lines": 10
                    },
                    {
                        "name": "-default",
                        "lines": 3
                    },
                    {
                        "name": "-no_upload",
                        "lines": 5
                    },
                    {
                        "name": "-unique_header",
                        "lines": 2
                    },
                    {
                        "name": "-carp",
                        "lines": 2
                    },
                    {
                        "name": "-croak",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "USING NPH SCRIPTS",
                "lines": 37,
                "subsections": []
            },
            {
                "name": "SERVER PUSH",
                "lines": 31,
                "subsections": [
                    {
                        "name": "multipart_end",
                        "lines": 29
                    }
                ]
            },
            {
                "name": "DEBUGGING",
                "lines": 147,
                "subsections": []
            },
            {
                "name": "ACCESSOR METHODS",
                "lines": 223,
                "subsections": [
                    {
                        "name": "url",
                        "lines": 6
                    },
                    {
                        "name": "-absolute",
                        "lines": 4
                    },
                    {
                        "name": "-relative",
                        "lines": 5
                    },
                    {
                        "name": "-full",
                        "lines": 11
                    },
                    {
                        "name": "-base",
                        "lines": 121
                    },
                    {
                        "name": "Globals Variables",
                        "lines": 36
                    },
                    {
                        "name": "cgi_error",
                        "lines": 71
                    },
                    {
                        "name": "Changes to pragmas",
                        "lines": 3
                    },
                    {
                        "name": "-any",
                        "lines": 1
                    },
                    {
                        "name": "-compile",
                        "lines": 1
                    },
                    {
                        "name": "-nosticky",
                        "lines": 1
                    },
                    {
                        "name": "-no_xhtml",
                        "lines": 1
                    },
                    {
                        "name": "-private_tempfiles",
                        "lines": 1
                    },
                    {
                        "name": "Filehandles",
                        "lines": 3
                    },
                    {
                        "name": "Hash interface",
                        "lines": 31
                    },
                    {
                        "name": "Core Methods",
                        "lines": 17
                    },
                    {
                        "name": "Save and Restore from File Methods",
                        "lines": 4
                    },
                    {
                        "name": "Miscellaneous Methods",
                        "lines": 7
                    },
                    {
                        "name": "Cookie Methods",
                        "lines": 3
                    },
                    {
                        "name": "Header Methods",
                        "lines": 5
                    },
                    {
                        "name": "Server Push Methods",
                        "lines": 5
                    },
                    {
                        "name": "Debugging Methods",
                        "lines": 22
                    },
                    {
                        "name": "Accessor Methods",
                        "lines": 38
                    },
                    {
                        "name": "parse_query_string",
                        "lines": 6
                    },
                    {
                        "name": "Internal Routines",
                        "lines": 13
                    },
                    {
                        "name": "New Public Methods",
                        "lines": 18
                    },
                    {
                        "name": "New Accessors",
                        "lines": 11
                    },
                    {
                        "name": "Guts - rearranged, recoded, renamed and hacked out of existence",
                        "lines": 56
                    },
                    {
                        "name": "Upload Related",
                        "lines": 15
                    },
                    {
                        "name": "Internal Multipart Parsing Routines",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "EXPORT",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR INFORMATION",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "CREDITS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "LICENCE AND COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CGI::Simple - A Simple totally OO CGI interface that is CGI.pm compliant\n",
                "subsections": []
            },
            "VERSION": {
                "content": "This document describes CGI::Simple version 1.280.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use CGI::Simple;\n$CGI::Simple::POSTMAX = 1024;       # max upload via post default 100kB\n$CGI::Simple::DISABLEUPLOADS = 0;   # enable uploads\n\n$q = CGI::Simple->new;\n$q = CGI::Simple->new( { 'foo'=>'1', 'bar'=>[2,3,4] } );\n$q = CGI::Simple->new( 'foo=1&bar=2&bar=3&bar=4' );\n$q = CGI::Simple->new( \\*FILEHANDLE );\n\n$q->save( \\*FILEHANDLE );   # save current object to a file as used by new\n\n@params = $q->param;        # return all param names as a list\n$value = $q->param('foo');  # return the first value supplied for 'foo'\n@values = $q->param('foo'); # return all values supplied for foo\n\n%fields   = $q->Vars;      # returns untied key value pair hash\n$hashref = $q->Vars;      # or as a hash ref\n%fields   = $q->Vars(\"|\"); # packs multiple values with \"|\" rather than \"\\0\";\n\n@keywords = $q->keywords;  # return all keywords as a list\n\n$q->param( 'foo', 'some', 'new', 'values' );      # set new 'foo' values\n$q->param( -name=>'foo', -value=>'bar' );\n$q->param( -name=>'foo', -value=>['bar','baz'] );\n\n$q->param( 'foo', 'some', 'new', 'values' );      # append values to 'foo'\n$q->append( -name=>'foo', -value=>'bar' );\n$q->append( -name=>'foo', -value=>['some', 'new', 'values'] );\n\n$q->delete('foo'); # delete param 'foo' and all its values\n$q->deleteall;    # delete everything\n\n<INPUT TYPE=\"file\" NAME=\"uploadfile\" SIZE=\"42\">\n\n$files    = $q->upload()                # number of files uploaded\n@files    = $q->upload();               # names of all uploaded files\n$filename = $q->param('uploadfile')    # filename of uploaded file\n$mime     = $q->uploadinfo($filename,'mime'); # MIME type of uploaded file\n$size     = $q->uploadinfo($filename,'size'); # size of uploaded file\n\nmy $fh = $q->upload($filename);         # get filehandle to read from\nwhile ( read( $fh, $buffer, 1024 ) ) { ... }\n\n# short and sweet upload\n$ok = $q->upload( $q->param('uploadfile'), '/path/to/write/file.name' );\nprint \"Uploaded \".$q->param('uploadfile').\" and wrote it OK!\" if $ok;\n\n$decoded    = $q->urldecode($encoded);\n$encoded    = $q->urlencode($unencoded);\n$escaped    = $q->escapeHTML('<>\"&');\n$unescaped  = $q->unescapeHTML('&lt;&gt;&quot;&amp;');\n\n$qs = $q->querystring; # get all data in $q as a query string OK for GET\n\n$q->nocache(1);        # set Pragma: no-cache + expires\nprint $q->header();     # print a simple header\n# get a complex header\n$header = $q->header(   -type       => 'image/gif'\n-nph        => 1,\n-status     => '402 Payment required',\n-expires    =>'+24h',\n-cookie     => $cookie,\n-charset    => 'utf-7',\n-attachment => 'foo.gif',\n-Cost       => '$2.00'\n);\n# a p3p header (OK for redirect use as well)\n$header = $q->header( -p3p => 'policyref=\"http://somesite.com/P3P/PolicyReferences.xml' );\n\n@cookies = $q->cookie();        # get names of all available cookies\n$value   = $q->cookie('foo')    # get first value of cookie 'foo'\n@value   = $q->cookie('foo')    # get all values of cookie 'foo'\n# get a cookie formatted for header() method\n$cookie  = $q->cookie(  -name    => 'Password',\n-values  => ['superuser','god','my dog woofie'],\n-expires => '+3d',\n-domain  => '.nowhere.com',\n-path    => '/cgi-bin/database',\n-secure  => 1\n);\nprint $q->header( -cookie=>$cookie );       # set cookie\n\nprint $q->redirect('http://go.away.now');   # print a redirect header\n\ndienice( $q->cgierror ) if $q->cgierror;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "CGI::Simple provides a relatively lightweight drop in replacement for CGI.pm. It shares an\nidentical OO interface to CGI.pm for parameter parsing, file upload, cookie handling and header\ngeneration. This module is entirely object oriented, however a complete functional interface is\navailable by using the CGI::Simple::Standard module.\n\nEssentially everything in CGI.pm that relates to the CGI (not HTML) side of things is available.\nThere are even a few new methods and additions to old ones! If you are interested in what has\ngone on under the hood see the Compatibility with CGI.pm section at the end.\n\nIn practical testing this module loads and runs about twice as fast as CGI.pm depending on the\nprecise task.\n\nCALLING CGI::Simple ROUTINES USING THE OBJECT INTERFACE\nHere is a very brief rundown on how you use the interface. Full details follow.\n",
                "subsections": [
                    {
                        "name": "First you need to initialize an object",
                        "content": "Before you can call a CGI::Simple method you must create a CGI::Simple object. You do that by\nusing the module and then calling the new() constructor:\n\nuse CGI::Simple;\nmy $q = CGI::Simple->new;\n\nIt is traditional to call your object $q for query or perhaps $cgi.\n"
                    },
                    {
                        "name": "Next you call methods on that object",
                        "content": "Once you have your object you can call methods on it using the -> arrow syntax For example to\nget the names of all the parameters passed to your script you would just write:\n\n@names = $q->param();\n\nMany methods are sensitive to the context in which you call them. In the example above the"
                    },
                    {
                        "name": "param",
                        "content": "When you call param('arg') with a single argument it assumes you want to get the value(s)\nassociated with that argument (parameter). If you ask for an array it gives you an array of all\nthe values associated with it's argument:\n\n@values = $q->param('foo');  # get all the values for 'foo'\n\nwhereas if you ask for a scalar like this:\n\n$value = $q->param('foo');   # get only the first value for 'foo'\n\nthen it returns only the first value (if more than one value for 'foo' exists).\n\nIn case you ased for a list it will return all the values preserving the order in which the\nvalues of the given key were passed in the request.\n\nMost CGI::Simple routines accept several arguments, sometimes as many as 10 optional ones! To\nsimplify this interface, all routines use a named argument calling style that looks like this:\n\nprint $q->header( -type=>'image/gif', -expires=>'+3d' );\n\nEach argument name is preceded by a dash. Neither case nor order matters in the argument list.\n-type, -Type, and -TYPE are all acceptable.\n\nSeveral routines are commonly called with just one argument. In the case of these routines you\ncan provide the single argument without an argument name. header() happens to be one of these\nroutines. In this case, the single argument is the document type.\n\nprint $q->header('text/html');\n\nSometimes methods expect a scalar, sometimes a reference to an array, and sometimes a reference\nto a hash. Often, you can pass any type of argument and the routine will do whatever is most\nappropriate. For example, the param() method can be used to set a CGI parameter to a single or a\nmulti-valued value. The two cases are shown below:\n\n$q->param(-name=>'veggie',-value=>'tomato');\n$q->param(-name=>'veggie',-value=>['tomato','tomahto','potato','potahto']);\n\nCALLING CGI::Simple ROUTINES USING THE FUNCTION INTERFACE\nFor convenience a functional interface is provided by the CGI::Simple::Standard module. This\nhides the OO details from you and allows you to simply call methods. You may either use\nAUTOLOADING of methods or import specific method sets into you namespace. Here are the first few\nexamples again using the function interface.\n\nuse CGI::Simple::Standard qw(-autoload);\n@names  = param();\n@values = param('foo');\n$value  = param('foo');\nprint header(-type=>'image/gif',-expires=>'+3d');\nprint header('text/html');\n\nYes that's it. Not a $q-> in sight. You just use the module and select how/which methods to\nload. You then just call the methods you want exactly as before but without the $q-> notation.\n\nWhen (if) you read the following docs and are using the functional interface just pretend the\n$q-> is not there.\n"
                    },
                    {
                        "name": "Selecting which methods to load",
                        "content": "When you use the functional interface Perl needs to be able to find the functions you call. The\nsimplest way of doing this is to use autoloading as shown above. When you use\nCGI::Simple::Standard with the '-autoload' pragma it exports a single AUTOLOAD sub into you\nnamespace. Every time you call a non existent function AUTOLOAD is called and will load the\nrequired function and install it in your namespace. Thus only the AUTOLOAD sub and those\nfunctions you specifically call will be imported.\n\nAlternatively CGI::Simple::Standard provides a range of function sets you can import or you can\njust select exactly what you want. You do this using the familiar\n\nuse CGI::Simple::Standard qw( :funcset  somefunc);\n\nnotation. This will import the ':funcset' function set and the specific function 'somefunc'.\n"
                    },
                    {
                        "name": "To Autoload or not to Autoload, that is the question.",
                        "content": "If you do not have a AUTOLOAD sub in you script it is generally best to use the '-autoload'\noption. Under autoload you can use any method you want but only import and compile those\nfunctions you actually use.\n\nIf you do not use autoload you must specify what functions to import. You can only use functions\nthat you have imported. For comvenience functions are grouped into related sets. If you choose\nto import one or more ':funcset' you may have potential namespace collisions so check out the\ndocs to see what gets imported. Using the ':all' tag is pretty slack but it is there if you\nwant. Full details of the function sets are provided in the CGI::Simple::Standard docs\n\nIf you just want say the param and header methods just load these two.\n\nuse CGI::Simple::Standard qw(param header);\n"
                    },
                    {
                        "name": "Setting globals using the functional interface",
                        "content": "Where you see global variables being set using the syntax:\n\n$CGI::Simple::DEBUG = 1;\n\nYou use exactly the same syntax when using CGI::Simple::Standard.\n"
                    }
                ]
            },
            "THE CORE METHODS": {
                "content": "new() Creating a new query object\nThe first step in using CGI::Simple is to create a new query object using the new() constructor:\n\n$q = CGI::Simple->new;\n\nThis will parse the input (from both POST and GET methods) and store it into an object called\n$q.\n\nIf you provide a file handle to the new() method, it will read parameters from the file (or\nSTDIN, or whatever).\n\nHistorically people were doing this way:\n\nopen FH, \"test.in\" or die $!;\n$q = CGI::Simple->new(\\*FH);\n\nbut this is the recommended way:\n\nopen $fh, '<', \"test.in\" or die $!;\n$q = CGI::Simple->new($fh);\n\nThe file should be a series of newline delimited TAG=VALUE pairs. Conveniently, this type of\nfile is created by the save() method (see below). Multiple records can be saved and restored.\nIO::File objects work fine.\n\nIf you are using the function-oriented interface provided by CGI::Simple::Standard and want to\ninitialize from a file handle, the way to do this is with restoreparameters(). This will\n(re)initialize the default CGI::Simple object from the indicated file handle.\n\nrestoreparameters($fh);\n\nIn fact for all intents and purposes restoreparameters() is identical to new() Note that",
                "subsections": [
                    {
                        "name": "restore_parameters",
                        "content": "You can also initialize the query object from an associative array reference:\n\n$q = CGI::Simple->new( { 'dinosaur' => 'barney',\n'song'     => 'I love you',\n'friends'  => [qw/Jessica George Nancy/] }\n);\n\nor from a properly formatted, URL-escaped query string:\n\n$q = CGI::Simple->new( 'dinosaur=barney&color=purple' );\n\nor from a previously existing CGI::Simple object (this generates an identical clone including\nall global variable settings, etc that are stored in the object):\n\n$oldquery = CGI::Simple->new;\n$newquery = CGI::Simple->new($oldquery);\n\nTo create an empty query, initialize it from an empty string or hash:\n\n$emptyquery = CGI::Simple->new(\"\");\n\n-or-\n\n$emptyquery = CGI::Simple->new({});\n\nkeywords() Fetching a list of keywords from a query\n@keywords = $q->keywords;\n\nIf the script was invoked as the result of an <ISINDEX> search, the parsed keywords can be\nobtained as an array using the keywords() method.\n\nparam() Fetching the names of all parameters passed to your script\n@names = $q->param;\n\nIf the script was invoked with a parameter list (e.g. \"name1=value1&name2=value2&name3=value3\"),\nthe param() method will return the parameter names as a list. If the script was invoked as an\n<ISINDEX> script and contains a string without ampersands (e.g. \"value1+value2+value3\") , there\nwill be a single parameter named \"keywords\" containing the \"+\"-delimited keywords.\n\nNOTE: The array of parameter names returned will be in the same order as they were submitted by\nthe browser. Usually this order is the same as the order in which the parameters are defined in\nthe form (however, this isn't part of the spec, and so isn't guaranteed).\n\nparam() Fetching the value or values of a simple named parameter\n@values = $q->param('foo');\n\n-or-\n\n$value = $q->param('foo');\n\nPass the param() method a single argument to fetch the value of the named parameter. If the\nparameter is multi-valued (e.g. from multiple selections in a scrolling list), you can ask to\nreceive an array. Otherwise the method will return a single value.\n\nIf a value is not given in the query string, as in the queries \"name1=&name2=\" or \"name1&name2\",\nit will be returned by default as an empty string. If you set the global variable:\n\n$CGI::Simple::NOUNDEFPARAMS = 1;\n\nThen value-less parameters will be ignored, and will not exist in the query object. If you try\nto access them via param you will get an undef return value.\n\nparam() Setting the values of a named parameter\n$q->param('foo','an','array','of','values');\n\nThis sets the value for the named parameter 'foo' to an array of values. This is one way to\nchange the value of a field.\n"
                    },
                    {
                        "name": "param",
                        "content": "$q->param(-name=>'foo',-values=>['an','array','of','values']);\n\n-or-\n\n$q->param(-name=>'foo',-value=>'the value');\n\nparam() Retrieving non-application/x-www-form-urlencoded data\nIf POSTed or PUTed data is not of type application/x-www-form-urlencoded or multipart/form-data,\nthen the data will not be processed, but instead be returned as-is in a parameter named POSTDATA\nor PUTDATA. To retrieve it, use code like this:\n\nmy $data = $q->param( 'POSTDATA' );\n\n-or-\n\nmy $data = $q->param( 'PUTDATA' );\n\n(If you don't know what the preceding means, don't worry about it. It only affects people trying\nto use CGI::Simple for REST webservices)\n\naddparam() Setting the values of a named parameter\nYou nay also use the new method addparam to add parameters. This is an alias to the\naddparam() internal method that actually does all the work. You can call it like this:\n\n$q->addparam('foo', 'new');\n$q->addparam('foo', [1,2,3,4,5]);\n$q->addparam( 'foo', 'bar', 'overwrite' );\n\nThe first argument is the parameter, the second the value or an array ref of values and the\noptional third argument sets overwrite mode. If the third argument is absent of false the values\nwill be appended. If true the values will overwrite any existing ones\n\nappend() Appending values to a named parameter\n$q->append(-name=>'foo',-values=>['yet','more','values']);\n\nThis adds a value or list of values to the named parameter. The values are appended to the end\nof the parameter if it already exists. Otherwise the parameter is created. Note that this method\nonly recognizes the named argument calling syntax.\n\nimportnames() Importing all parameters into a namespace.\nThis method was silly, non OO and has been deleted. You can get all the params as a hash using\nVars or via all the other accessors.\n\ndelete() Deleting a parameter completely\n$q->delete('foo');\n\nThis completely clears a parameter. If you are using the function call interface, use Delete()\ninstead to avoid conflicts with Perl's built-in delete operator.\n\nIf you are using the function call interface, use Delete() instead to avoid conflicts with\nPerl's built-in delete operator.\n\ndeleteall() Deleting all parameters\n$q->deleteall();\n\nThis clears the CGI::Simple object completely. For CGI.pm compatibility Deleteall() is provided\nhowever there is no reason to use this in the function call interface other than symmetry.\n\nFor CGI.pm compatibility Deleteall() is provided as an alias for deleteall however there is no\nreason to use this, even in the function call interface.\n\nparamfetch() Direct access to the parameter list\nThis method is provided for CGI.pm compatibility only. It returns an array ref to the values\nassociated with a named param. It is deprecated.\n\nVars() Fetching the entire parameter list as a hash\n$params = $q->Vars;  # as a tied hash ref\nprint $params->{'address'};\n@foo = split \"\\0\", $params->{'foo'};\n\n%params = $q->Vars;  # as a plain hash\nprint $params{'address'};\n@foo = split \"\\0\", $params{'foo'};\n\n%params = $q->Vars(','); # specifying a different separator than \"\\0\"\n@foo = split ',', $params{'foo'};\n\nMany people want to fetch the entire parameter list as a hash in which the keys are the names of\nthe CGI parameters, and the values are the parameters' values. The Vars() method does this.\n\nCalled in a scalar context, it returns the parameter list as a tied hash reference. Because this\nhash ref is tied changing a key/value changes the underlying CGI::Simple object.\n\nCalled in a list context, it returns the parameter list as an ordinary hash. Changing this hash\nwill not change the underlying CGI::Simple object\n\nWhen using Vars(), the thing you must watch out for are multi-valued CGI parameters. Because a\nhash cannot distinguish between scalar and list context, multi-valued parameters will be\nreturned as a packed string, separated by the \"\\0\" (null) character. You must split this packed\nstring in order to get at the individual values. This is the convention introduced long ago by\nSteve Brenner in his cgi-lib.pl module for Perl version 4.\n\nYou can change the character used to do the multiple value packing by passing it to Vars() as an\nargument as shown.\n\nurlparam() Access the QUERYSTRING regardless of 'GET' or 'POST'\nThe urlparam() method makes the QUERYSTRING data available regardless of whether the\nREQUESTMETHOD was 'GET' or 'POST'. You can do anything with urlparam that you can do with"
                    },
                    {
                        "name": "param",
                        "content": "Technically what happens if you use this method is that the QUERYSTRING data is parsed into a\nnew CGI::Simple object which is stored within the current object. urlparam then just calls"
                    },
                    {
                        "name": "param",
                        "content": "parsequerystring() Add QUERYSTRING data to 'POST' requests\nWhen the REQUESTMETHOD is 'POST' the default behavior is to ignore name/value pairs or keywords\nin the $ENV{'QUERYSTRING'}. You can override this by calling parsequerystring() which will\nadd the QUERYSTRING data to the data already in our CGI::Simple object if the REQUESTMETHOD\nwas 'POST'\n\n$q = CGI::Simple->new;\n$q->parsequerystring;  # add $ENV{'QUERYSTRING'} data to our $q object\n\nIf the REQUESTMETHOD was 'GET' then the QUERYSTRING will already be stored in our object so\nparsequerystring will be ignored.\n\nThis is a new method in CGI::Simple that is not available in CGI.pm\n\nsave() Saving the state of an object to file\n$q->save(\\*FILEHANDLE)\n\nThis will write the current state of the form to the provided filehandle. You can read it back\nin by providing a filehandle to the new() method.\n\nThe format of the saved file is:\n\nNAME1=VALUE1\nNAME1=VALUE1'\nNAME2=VALUE2\nNAME3=VALUE3\n=\n\nBoth name and value are URL escaped. Multi-valued CGI parameters are represented as repeated\nnames. A session record is delimited by a single = symbol. You can write out multiple records\nand read them back in with several calls to new().\n\nopen my $fh, '<', \"test.in\" or die $!;\n$q1 = CGI::Simple->new($fh);  # get the first record\n$q2 = CGI::Simple->new($fh);  # get the next record\n\nNote: If you wish to use this method from the function-oriented (non-OO) interface, the exported\nname for this method is saveparameters(). Also if you want to initialize from a file handle,\nthe way to do this is with restoreparameters(). This will (re)initialize the default\nCGI::Simple object from the indicated file handle.\n\nrestoreparameters($fh);\n"
                    }
                ]
            },
            "FILE UPLOADS": {
                "content": "File uploads are easy with CGI::Simple. You use the upload() method. Assuming you have the\nfollowing in your HTML:\n\n<FORM\nMETHOD=\"POST\"\nACTION=\"http://somewhere.com/cgi-bin/script.cgi\"\nENCTYPE=\"multipart/form-data\">\n<INPUT TYPE=\"file\" NAME=\"uploadfile1\" SIZE=\"42\">\n<INPUT TYPE=\"file\" NAME=\"uploadfile2\" SIZE=\"42\">\n</FORM>\n\nNote that the ENCTYPE is \"multipart/form-data\". You must specify this or the browser will\ndefault to \"application/x-www-form-urlencoded\" which will result in no files being uploaded\nalthough on the surface things will appear OK.\n\nWhen the user submits this form any supplied files will be spooled onto disk and saved in\ntemporary files. These files will be deleted when your script.cgi exits so if you want to keep\nthem you will need to proceed as follows.\n\nupload() The key file upload method\nThe upload() method is quite versatile. If you call upload() without any arguments it will\nreturn a list of uploaded files in list context and the number of uploaded files in scalar\ncontext.\n\n$numberoffiles = $q->upload;\n@listoffiles   = $q->upload;\n\nHaving established that you have uploaded files available you can get the browser supplied\nfilename using param() like this:\n\n$filename1 = $q->param('uploadfile1');\n\nYou can then get a filehandle to read from by calling upload() and supplying this filename as an\nargument. Warning: do not modify the value you get from param() in any way - you don't need to\nuntaint it.\n\n$fh = $q->upload( $filename1 );\n\nNow to save the file you would just do something like:\n\n$savepath = '/path/to/write/file.name';\nopen my $out, '>', $savepath or die \"Oops $!\\n\";\nbinmode $out;\nprint $out $buffer while read( $fh, $buffer, 4096 );\nclose $out;\n\nBy utilizing a new feature of the upload method this process can be simplified to:\n\n$ok = $q->upload( $q->param('uploadfile1'), '/path/to/write/file.name' );\nif ($ok) {\nprint \"Uploaded and wrote file OK!\";\n} else {\nprint $q->cgierror();\n}\n\nAs you can see upload will accept an optional second argument and will write the file to this\nfile path. It will return 1 for success and undef if it fails. If it fails you can get the error\nfrom cgierror\n\nYou can also use just the fieldname as an argument to upload ie:\n\n$fh = $q->upload( 'uploadfieldname' );\n\nor\n\n$ok = $q->upload( 'uploadfieldname', '/path/to/write/file.name' );\n\nBUT there is a catch. If you have multiple upload fields, all called 'uploadfieldname' then\nyou will only get the last uploaded file from these fields.\n\nuploadinfo() Get the details about uploaded files\nThe uploadinfo() method is a new method. Called without arguments it returns the number of\nuploaded files in scalar context and the names of those files in list context.\n\n$numberofuploadfiles   = $q->uploadinfo();\n@filenamesofalluploads = $q->uploadinfo();\n\nYou can get the MIME type of an uploaded file like this:\n\n$mime = $q->uploadinfo( $filename1, 'mime' );\n\nIf you want to know how big a file is before you copy it you can get that information from\nuploadInfo which will return the file size in bytes.\n\n$filesize = $q->uploadinfo( $filename1, 'size' );\n\nThe size attribute is optional as this is the default value returned.\n\nNote: The old CGI.pm uploadInfo() method has been deleted.\n\n$POSTMAX and $DISABLEUPLOADS\nCGI.pm has a default setting that allows infinite size file uploads by default. In contrast file\nuploads are disabled by default in CGI::Simple to discourage Denial of Service attacks. You must\nenable them before you expect file uploads to work.\n\nWhen file uploads are disabled the file name and file size details will still be available from",
                "subsections": [
                    {
                        "name": "param",
                        "content": "undefined - not surprising as the underlying temp file will not exist either.\n\nYou can enable uploads using the '-upload' pragma. You do this by specifying this in you use\nstatement:\n\nuse CGI::Simple qw(-upload);\n\nAlternatively you can enable uploads via the $DISABLEUPLOADS global like this:\n\nuse CGI::Simple;\n$CGI::Simple::DISABLEUPLOADS = 0;\n$q = CGI::Simple->new;\n\nIf you wish to set $DISABLEUPLOADS you must do this *after* the use statement and *before* the\nnew constructor call as shown above.\n\nThe maximum acceptable data via post is capped at 102400kB rather than infinity which is the\nCGI.pm default. This should be ample for most tasks but you can set this to whatever you want\nusing the $POSTMAX global.\n\nuse CGI::Simple;\n$CGI::Simple::DISABLEUPLOADS = 0;      # enable uploads\n$CGI::Simple::POSTMAX = 1048576;     # allow 1MB uploads\n$q = CGI::Simple->new;\n\nIf you set to -1 infinite size uploads will be permitted, which is the CGI.pm default.\n\n$CGI::Simple::POSTMAX = -1;            # infinite size upload\n\nAlternatively you can specify all the CGI.pm default values which allow file uploads of infinite\nsize in one easy step by specifying the '-default' pragma in your use statement.\n\nuse CGI::Simple qw( -default ..... );\n\nbinmode() and Win32\nIf you are using CGI::Simple be sure to call binmode() on any handle that you create to write\nthe uploaded file to disk. Calling binmode() will do no harm on other systems anyway.\n"
                    }
                ]
            },
            "MISCELANEOUS METHODS": {
                "content": "escapeHTML() Escaping HTML special characters\nIn HTML the < > \" and & chars have special meaning and need to be escaped to &lt; &gt; &quot;\nand &amp; respectively.\n\n$escaped = $q->escapeHTML( $string );\n\n$escaped = $q->escapeHTML( $string, 'newlinestoo' );\n\nIf the optional second argument is supplied then newlines will be escaped to.\n\nunescapeHTML() Unescape HTML special characters\nThis performs the reverse of escapeHTML().\n\n$unescaped = $q->unescapeHTML( $HTMLescapedstring );\n\nurldecode() Decode a URL encoded string\nThis method will correctly decode a url encoded string.\n\n$decoded = $q->urldecode( $encoded );\n\nurlencode() URL encode a string\nThis method will correctly URL encode a string.\n\n$encoded = $q->urlencode( $string );\n\nparsekeywordlist() Parse a supplied keyword list\n@keywords = $q->parsekeywordlist( $keywordlist );\n\nThis method returns a list of keywords, correctly URL escaped and split out of the supplied\nstring\n\nput() Send output to browser\nCGI.pm alias for print. $q->put('Hello World!') will print the usual\n\nprint() Send output to browser\nCGI.pm alias for print. $q->print('Hello World!') will print the usual\n",
                "subsections": []
            },
            "HTTP COOKIES": {
                "content": "CGI.pm has several methods that support cookies.\n\nA cookie is a name=value pair much like the named parameters in a CGI query string. CGI scripts\ncreate one or more cookies and send them to the browser in the HTTP header. The browser\nmaintains a list of cookies that belong to a particular Web server, and returns them to the CGI\nscript during subsequent interactions.\n\nIn addition to the required name=value pair, each cookie has several optional attributes:\n\n1. an expiration time\nThis is a time/date string (in a special GMT format) that indicates when a cookie expires.\nThe cookie will be saved and returned to your script until this expiration date is reached\nif the user exits the browser and restarts it. If an expiration date isn't specified, the\ncookie will remain active until the user quits the browser.\n\n2. a domain\nThis is a partial or complete domain name for which the cookie is valid. The browser will\nreturn the cookie to any host that matches the partial domain name. For example, if you\nspecify a domain name of \".capricorn.com\", then the browser will return the cookie to Web\nservers running on any of the machines \"www.capricorn.com\", \"www2.capricorn.com\",\n\"feckless.capricorn.com\", etc. Domain names must contain at least two periods to prevent\nattempts to match on top level domains like \".edu\". If no domain is specified, then the\nbrowser will only return the cookie to servers on the host the cookie originated from.\n\n3. a path\nIf you provide a cookie path attribute, the browser will check it against your script's URL\nbefore returning the cookie. For example, if you specify the path \"/cgi-bin\", then the\ncookie will be returned to each of the scripts \"/cgi-bin/tally.pl\", \"/cgi-bin/order.pl\", and\n\"/cgi-bin/customerservice/complain.pl\", but not to the script \"/cgi-private/siteadmin.pl\".\nBy default, path is set to \"/\", which causes the cookie to be sent to any CGI script on your\nsite.\n\n4. a \"secure\" flag\nIf the \"secure\" attribute is set, the cookie will only be sent to your script if the CGI\nrequest is occurring on a secure channel, such as SSL.\n\ncookie() A simple access method to cookies\nThe interface to HTTP cookies is the cookie() method:\n\n$cookie = $q->cookie( -name      => 'sessionID',\n-value     => 'xyzzy',\n-expires   => '+1h',\n-path      => '/cgi-bin/database',\n-domain    => '.capricorn.org',\n-secure    => 1\n);\nprint $q->header(-cookie=>$cookie);\n",
                "subsections": [
                    {
                        "name": "cookie",
                        "content": ""
                    },
                    {
                        "name": "-name",
                        "content": "The name of the cookie (required). This can be any string at all. Although browsers limit\ntheir cookie names to non-whitespace alphanumeric characters, CGI.pm removes this\nrestriction by escaping and unescaping cookies behind the scenes.\n"
                    },
                    {
                        "name": "-value",
                        "content": "The value of the cookie. This can be any scalar value, array reference, or even associative\narray reference. For example, you can store an entire associative array into a cookie this\nway:\n\n$cookie=$q->cookie( -name   => 'family information',\n-value  => \\%childrensages );\n"
                    },
                    {
                        "name": "-path",
                        "content": "The optional partial path for which this cookie will be valid, as described above.\n"
                    },
                    {
                        "name": "-domain",
                        "content": "The optional partial domain for which this cookie will be valid, as described above.\n"
                    },
                    {
                        "name": "-expires",
                        "content": "The optional expiration date for this cookie. The format is as described in the section on\nthe header() method:\n\n\"+1h\"  one hour from now\n"
                    },
                    {
                        "name": "-secure",
                        "content": "If set to true, this cookie will only be used within a secure SSL session.\n\nThe cookie created by cookie() must be incorporated into the HTTP header within the string\nreturned by the header() method:\n\nprint $q->header(-cookie=>$mycookie);\n\nTo create multiple cookies, give header() an array reference:\n\n$cookie1 = $q->cookie( -name  => 'riddlename',\n-value => \"The Sphynx's Question\"\n);\n$cookie2 = $q->cookie( -name  => 'answers',\n-value => \\%answers\n);\nprint $q->header( -cookie => [ $cookie1, $cookie2 ] );\n\nTo retrieve a cookie, request it by name by calling cookie() method without the -value\nparameter:\n\nuse CGI::Simple;\n$q = CGI::Simple->new;\n$riddle  = $q->cookie('riddlename');\n%answers = $q->cookie('answers');\n\nCookies created with a single scalar value, such as the \"riddlename\" cookie, will be returned\nin that form. Cookies with array and hash values can also be retrieved.\n\nThe cookie and CGI::Simple namespaces are separate. If you have a parameter named 'answers' and\na cookie named 'answers', the values retrieved by param() and cookie() are independent of each\nother. However, it's simple to turn a CGI parameter into a cookie, and vice-versa:\n\n# turn a CGI parameter into a cookie\n$c = $q->cookie( -name=>'answers', -value=>[$q->param('answers')] );\n# vice-versa\n$q->param( -name=>'answers', -value=>[$q->cookie('answers')] );\n\nrawcookie()\nReturns the HTTPCOOKIE variable. Cookies have a special format, and this method call just\nreturns the raw form (?cookie dough). See cookie() for ways of setting and retrieving cooked\ncookies.\n\nCalled with no parameters, rawcookie() returns the packed cookie structure. You can separate it\ninto individual cookies by splitting on the character sequence \"; \". Called with the name of a\ncookie, retrieves the unescaped form of the cookie. You can use the regular cookie() method to\nget the names, or use the rawfetch() method from the CGI::Simmple::Cookie module.\n"
                    }
                ]
            },
            "CREATING HTTP HEADERS": {
                "content": "Normally the first thing you will do in any CGI script is print out an HTTP header. This tells\nthe browser what type of document to expect, and gives other optional information, such as the\nlanguage, expiration date, and whether to cache the document. The header can also be manipulated\nfor special purposes, such as server push and pay per view pages.\n\nheader() Create simple or complex HTTP headers\nprint $q->header;\n\n-or-\n\nprint $q->header('image/gif');\n\n-or-\n\nprint $q->header('text/html','204 No response');\n\n-or-\n\nprint $q->header( -type       => 'image/gif',\n-nph        => 1,\n-status     => '402 Payment required',\n-expires    => '+3d',\n-cookie     => $cookie,\n-charset    => 'utf-7',\n-attachment => 'foo.gif',\n-Cost       => '$2.00'\n);\n",
                "subsections": [
                    {
                        "name": "header",
                        "content": "otherwise it defaults to text/html. An optional second parameter specifies the status code and a\nhuman-readable message. For example, you can specify 204, \"No response\" to create a script that\ntells the browser to do nothing at all.\n\nThe last example shows the named argument style for passing arguments to the CGI methods using\nnamed parameters. Recognized parameters are -type, -status, -cookie, -target, -expires, -nph,\n-charset and -attachment. Any other named parameters will be stripped of their initial hyphens\nand turned into header fields, allowing you to specify any HTTP header you desire.\n\nFor example, you can produce non-standard HTTP header fields by providing them as named\narguments:\n\nprint $q->header( -type            => 'text/html',\n-nph             => 1,\n-cost            => 'Three smackers',\n-annoyancelevel => 'high',\n-complaintsto   => 'bit bucket'\n);\n\nThis will produce the following non-standard HTTP header:\n\nHTTP/1.0 200 OK\nCost: Three smackers\nAnnoyance-level: high\nComplaints-to: bit bucket\nContent-type: text/html\n\nNote that underscores are translated automatically into hyphens. This feature allows you to keep\nup with the rapidly changing HTTP \"standards\".\n\nThe -type is a key element that tell the browser how to display your document. The default is\n'text/html'. Common types are:\n\ntext/html\ntext/plain\nimage/gif\nimage/jpg\nimage/png\napplication/octet-stream\n\nThe -status code is the HTTP response code. The default is 200 OK. Common status codes are:\n\n200 OK\n204 No Response\n301 Moved Permanently\n302 Found\n303 See Other\n307 Temporary Redirect\n400 Bad Request\n401 Unauthorized\n403 Forbidden\n404 Not Found\n405 Not Allowed\n408 Request Timed Out\n500 Internal Server Error\n503 Service Unavailable\n504 Gateway Timed Out\n\nThe -expires parameter lets you indicate to a browser and proxy server how long to cache pages\nfor. When you specify an absolute or relative expiration interval with this parameter, some\nbrowsers and proxy servers will cache the script's output until the indicated expiration date.\nThe following forms are all valid for the -expires field:\n\n+30s                                30 seconds from now\n+10m                                ten minutes from now\n+1h                                 one hour from now\n-1d                                 yesterday (i.e. \"ASAP!\")\nnow                                 immediately\n+3M                                 in three months\n+10y                                in ten years time\nThursday, 25-Apr-1999 00:40:33 GMT  at the indicated time & date\n\nThe -cookie parameter generates a header that tells the browser to provide a \"magic cookie\"\nduring all subsequent transactions with your script. Netscape cookies have a special format that\nincludes interesting attributes such as expiration time. Use the cookie() method to create and\nretrieve session cookies.\n\nThe -target is for frames use\n\nThe -nph parameter, if set to a true value, will issue the correct headers to work with a NPH\n(no-parse-header) script. This is important to use with certain servers that expect all their\nscripts to be NPH.\n\nThe -charset parameter can be used to control the character set sent to the browser. If not\nprovided, defaults to ISO-8859-1. As a side effect, this sets the charset() method as well.\n\nThe -attachment parameter can be used to turn the page into an attachment. Instead of displaying\nthe page, some browsers will prompt the user to save it to disk. The value of the argument is\nthe suggested name for the saved file. In order for this to work, you may have to set the -type\nto 'application/octet-stream'.\n\nnocache() Preventing browser caching of scripts\nMost browsers will not cache the output from CGI scripts. Every time the browser reloads the\npage, the script is invoked anew. However some browsers do cache pages. You can discourage this\nbehavior using the nocache() function.\n\n$q->nocache(1); # turn caching off by sending appropriate headers\n$q->nocache(1); # do not send cache related headers.\n\n$q->nocache(1);\nprint header (-type=>'image/gif', -nph=>1);\n\nThis will produce a header like the following:\n\nHTTP/1.0 200 OK\nServer: Apache - accept no substitutes\nExpires: Thu, 15 Nov 2001 03:37:50 GMT\nDate: Thu, 15 Nov 2001 03:37:50 GMT\nPragma: no-cache\nContent-Type: image/gif\n\nBoth the Pragma: no-cache header field and an Expires header that corresponds to the current\ntime (ie now) will be sent.\n\ncache() Preventing browser caching of scripts\nThe somewhat ill named cache() method is a legacy from CGI.pm. It operates the same as the new"
                    },
                    {
                        "name": "no_cache",
                        "content": "line being printed. Expires time data is not sent.\n\nredirect() Generating a redirection header\nprint $q->redirect('http://somewhere.else/in/movie/land');\n\nSometimes you don't want to produce a document yourself, but simply redirect the browser\nelsewhere, perhaps choosing a URL based on the time of day or the identity of the user.\n\nThe redirect() function redirects the browser to a different URL. If you use redirection like\nthis, you should not print out a header as well.\n\nOne hint I can offer is that relative links may not work correctly when you generate a\nredirection to another document on your site. This is due to a well-intentioned optimization\nthat some servers use. The solution to this is to use the full URL (including the http: part) of\nthe document you are redirecting to.\n\nYou can also use named arguments:\n\nprint $q->redirect( -uri=>'http://somewhere.else/in/movie/land',\n-nph=>1\n);\n\nThe -nph parameter, if set to a true value, will issue the correct headers to work with a NPH\n(no-parse-header) script. This is important to use with certain servers, such as Microsoft ones,\nwhich expect all their scripts to be NPH.\n"
                    }
                ]
            },
            "PRAGMAS": {
                "content": "There are a number of pragmas that you can specify in your use CGI::Simple statement. Pragmas,\nwhich are always preceded by a hyphen, change the way that CGI::Simple functions in various\nways. You can generally achieve exactly the same results by setting the underlying\n$GLOBALVARIABLES.\n\nFor example the '-upload' pargma will enable file uploads:\n\nuse CGI::Simple qw(-upload);\n\nIn CGI::Simple::Standard Pragmas, function sets , and individual functions can all be imported\nin the same use() line. For example, the following use statement imports the standard set of\nfunctions and enables debugging mode (pragma -debug):\n\nuse CGI::Simple::Standard qw(:standard -debug);\n\nThe current list of pragmas is as follows:\n",
                "subsections": [
                    {
                        "name": "-no_undef_params",
                        "content": "If a value is not given in the query string, as in the queries \"name1=&name2=\" or\n\"name1&name2\", by default it will be returned as an empty string.\n\nIf you specify the '-noundefparams' pragma then CGI::Simple ignores parameters with no\nvalues and they will not appear in the query object.\n"
                    },
                    {
                        "name": "-nph",
                        "content": "This makes CGI.pm produce a header appropriate for an NPH (no parsed header) script. You may\nneed to do other things as well to tell the server that the script is NPH. See the\ndiscussion of NPH scripts below.\n"
                    },
                    {
                        "name": "-newstyle_urls",
                        "content": "Separate the name=value pairs in CGI parameter query strings with semicolons rather than\nampersands. For example:\n\n?name=fred;age=24;favoritecolor=3\n\nSemicolon-delimited query strings are always accepted, but will not be emitted by selfurl()\nand querystring() unless the -newstyleurls pragma is specified.\n"
                    },
                    {
                        "name": "-oldstyle_urls",
                        "content": "Separate the name=value pairs in CGI parameter query strings with ampersands rather than\nsemicolons. This is the default.\n\n?name=fred&age=24&favoritecolor=3\n"
                    },
                    {
                        "name": "-autoload",
                        "content": "This is only available for CGI::Simple::Standard and uses AUTOLOAD to load functions on\ndemand. See the CGI::Simple::Standard docs for details.\n"
                    },
                    {
                        "name": "-no_debug",
                        "content": "This turns off the command-line processing features. This is the default.\n\n-debug1 and debug2\nThis turns on debugging. At debug level 1 CGI::Simple will read arguments from the\ncommand-line. At debug level 2 CGI.pm will produce the prompt \"(offline mode: enter\nname=value pairs on standard input)\" and wait for input on STDIN. If no number is specified\nthen a debug level of 2 is used.\n\nSee the section on debugging for more details.\n"
                    },
                    {
                        "name": "-default",
                        "content": "This sets the default global values for CGI.pm which will enable infinite size file uploads,\nand specify the '-newstyleurls' and '-debug1' pragmas\n"
                    },
                    {
                        "name": "-no_upload",
                        "content": "Disable uploads - the default setting\n\n- upload\nEnable uploads - the CGI.pm default\n"
                    },
                    {
                        "name": "-unique_header",
                        "content": "Only allows headers to be generated once per script invocation\n"
                    },
                    {
                        "name": "-carp",
                        "content": "Carp when cgierror() called, default is to do nothing\n"
                    },
                    {
                        "name": "-croak",
                        "content": "Croak when cgierror() called, default is to do nothing\n"
                    }
                ]
            },
            "USING NPH SCRIPTS": {
                "content": "NPH, or \"no-parsed-header\", scripts bypass the server completely by sending the complete HTTP\nheader directly to the browser. This has slight performance benefits, but is of most use for\ntaking advantage of HTTP extensions that are not directly supported by your server, such as\nserver push and PICS headers.\n\nServers use a variety of conventions for designating CGI scripts as NPH. Many Unix servers look\nat the beginning of the script's name for the prefix \"nph-\". The Macintosh WebSTAR server and\nMicrosoft's Internet Information Server, in contrast, try to decide whether a program is an NPH\nscript by examining the first line of script output.\n\nCGI.pm supports NPH scripts with a special NPH mode. When in this mode, CGI.pm will output the\nnecessary extra header information when the header() and redirect() methods are called. You can\nset NPH mode in any of the following ways:\n\nIn the use statement\nSimply add the \"-nph\" pragma to the use:\n\nuse CGI::Simple qw(-nph)\n\nBy calling the nph() method:\nCall nph() with a non-zero parameter at any point after using CGI.pm in your program.\n\n$q->nph(1)\n\nBy using -nph parameters\nin the header() and redirect() statements:\n\nprint $q->header(-nph=>1);\n\nThe Microsoft Internet Information Server requires NPH mode. CGI::Simple will automatically\ndetect when the script is running under IIS and put itself into this mode. You do not need to do\nthis manually, although it won't hurt anything if you do. However, note that if you have applied\nService Pack 6, much of the functionality of NPH scripts, including the ability to redirect\nwhile setting a cookie, b<do not work at all> on IIS without a special patch from Microsoft. See\nhttp://support.microsoft.com/support/kb/articles/Q280/3/41.ASP: Non-Parsed Headers Stripped From\nCGI Applications That Have nph- Prefix in Name.\n",
                "subsections": []
            },
            "SERVER PUSH": {
                "content": "CGI.pm provides four simple functions for producing multipart documents of the type needed to\nimplement server push. These functions were graciously provided by Ed Jordan <ed@fidalgo.net>\nwith additions from Andrew Benham <adsb@bigfoot.com>\n\nYou are also advised to put the script into NPH mode and to set $| to 1 to avoid buffering\nproblems.\n\nBrowser support for server push is variable.\n\nHere is a simple script that demonstrates server push:\n\n#!/usr/local/bin/perl\nuse CGI::Simple::Standard qw/:push -nph/;\n$| = 1;\nprint multipartinit(-boundary=>'----here we go!');\nforeach (0 .. 4) {\nprint multipartstart(-type=>'text/plain'),\n\"The current time is \",scalar(localtime),\"\\n\";\nif ($ < 4) {\nprint multipartend;\n}\nelse {\nprint multipartfinal;\n}\nsleep 1;\n}\n\nThis script initializes server push by calling multipartinit(). It then enters a loop in which\nit begins a new multipart section by calling multipartstart(), prints the current local time,\nand ends a multipart section with multipartend(). It then sleeps a second, and begins again. On\nthe final iteration, it ends the multipart section with multipartfinal() rather than with",
                "subsections": [
                    {
                        "name": "multipart_end",
                        "content": "multipartinit() Initialize the multipart system\nmultipartinit(-boundary=>$boundary);\n\nInitialize the multipart system. The -boundary argument specifies what MIME boundary string to\nuse to separate parts of the document. If not provided, CGI.pm chooses a reasonable boundary for\nyou.\n\nmultipartstart() Start a new part of the multipart document\nmultipartstart(-type=>$type)\n\nStart a new part of the multipart document using the specified MIME type. If not specified,\ntext/html is assumed.\n\nmultipartend() End a multipart part\nmultipartend()\n\nEnd a part. You must remember to call multipartend() once for each multipartstart(), except at\nthe end of the last part of the multipart document when multipartfinal() should be called\ninstead of multipartend().\n\nmultipartfinal()\nmultipartfinal()\n\nEnd all parts. You should call multipartfinal() rather than multipartend() at the end of the\nlast part of the multipart document.\n\nCGI::Push\nUsers interested in server push applications should also have a look at the CGI::Push module.\n"
                    }
                ]
            },
            "DEBUGGING": {
                "content": "If you are running the script from the command line or in the perl debugger, you can pass the\nscript a list of keywords or parameter=value pairs on the command line or from standard input\n(you don't have to worry about tricking your script into reading from environment variables).\nBefore you do this you will need to change the debug level from the default level of 0 (no\ndebug) to either 1 if you want to debug from @ARGV (the command line) of 2 if you want to debug\nfrom STDIN. You can do this using the debug pragma like this:\n\nuse CGI::Simple qw(-debug2);  # set debug to level 2 => from STDIN\n\nor this:\n\n$CGI::Simple::DEBUG = 1;      # set debug to level 1 => from @ARGV\n\nAt debug level 1 you can pass keywords and name=value pairs like this:\n\nyourscript.pl keyword1 keyword2 keyword3\n\nor this:\n\nyourscript.pl keyword1+keyword2+keyword3\n\nor this:\n\nyourscript.pl name1=value1 name2=value2\n\nor this:\n\nyourscript.pl name1=value1&name2=value2\n\nAt debug level 2 you can feed newline-delimited name=value pairs to the script on standard\ninput. You will be presented with the following prompt:\n\n(offline mode: enter name=value pairs on standard input)\n\nYou end the input with your system dependent end of file character. You should try ^Z ^X ^D and\n^C if all else fails. The ^ means hold down the [Ctrl] button while you press the other key.\n\nWhen debugging, you can use quotes and backslashes to escape characters in the familiar shell\nmanner, letting you place spaces and other funny characters in your parameter=value pairs:\n\nyourscript.pl \"name1='I am a long value'\" \"name2=two\\ words\"\n\nDump() Dumping the current object details\nThe Dump() method produces a string consisting of all the query's object attributes formatted\nnicely as a nested list. This dump includes the name/value pairs and a number of other details.\nThis is useful for debugging purposes:\n\nprint $q->Dump\n\nThe actual result of this is HTML escaped formatted text wrapped in <pre> tags so if you send it\nstraight to the browser it produces something that looks like:\n\n$VAR1 = bless( {\n'.parameters' => [\n'name',\n'color'\n],\n'.globals' => {\n'FATAL' => -1,\n'DEBUG' => 0,\n'NONULL' => 1,\n'POSTMAX' => 102400,\n'USECGIPMDEFAULTS' => 0,\n'HEADERSONCE' => 0,\n'NPH' => 0,\n'DISABLEUPLOADS' => 1,\n'NOUNDEFPARAMS' => 0,\n'USEPARAMSEMICOLONS' => 0\n},\n'.fieldnames' => {\n'color' => '1',\n'name' => '1'\n},\n'.modperl' => '',\n'color' => [\n'red',\n'green',\n'blue'\n],\n'name' => [\n'JaPh,'\n]\n}, 'CGI::Simple' );\n\nYou may recognize this as valid Perl syntax (which it is) and/or the output from Data::Dumper\n(also true). This is the actual guts of how the information is stored in the query object. All\nthe internal params start with a . char\n\nAlternatively you can dump your object and the current environment using:\n\nprint $q->Dump(\\%ENV);\n\nPrintEnv() Dumping the environment\nYou can get a similar browser friendly dump of the current %ENV hash using:\n\nprint $q->PrintEnv;\n\nThis will produce something like (in the browser):\n\n$VAR1 = {\n'QUERYSTRING' => 'name=JaPh%2C&color=red&color=green&color=blue',\n'CONTENTTYPE' => 'application/x-www-form-urlencoded',\n'REGRESSIONTEST' => 'simple.t.pl',\n'VIM' => 'C:\\\\WINDOWS\\\\Desktop\\\\vim',\n'HTTPREFERER' => 'xxx.sex.com',\n'HTTPUSERAGENT' => 'LWP',\n'HTTPACCEPT' => 'text/html;q=1, image/gif;q=0.42, */*;q=0.001',\n'REMOTEHOST' => 'localhost',\n'HTTPHOST' => 'the.restaurant.at.the.end.of.the.universe',\n'GATEWAYINTERFACE' => 'bleeding edge',\n'REMOTEIDENT' => 'None of your damn business',\n'SCRIPTNAME' => '/cgi-bin/foo.cgi',\n'SERVERNAME' => 'nowhere.com',\n'HTTPCOOKIE' => '',\n'CONTENTLENGTH' => '42',\n'HTTPSA' => 'A',\n'HTTPFROM' => 'spammer@nowhere.com',\n'HTTPSB' => 'B',\n'SERVERPROTOCOL' => 'HTTP/1.0',\n'PATHTRANSLATED' => '/usr/local/somewhere/else',\n'SERVERSOFTWARE' => 'Apache - accept no substitutes',\n'PATHINFO' => '/somewhere/else',\n'REMOTEUSER' => 'Just another Perl hacker,',\n'REMOTEADDR' => '127.0.0.1',\n'HTTPS' => 'ON',\n'DOCUMENTROOT' => '/vs/www/foo',\n'REQUESTMETHOD' => 'GET',\n'REDIRECTQUERYSTRING' => '',\n'AUTHTYPE' => 'PGP MD5 DES rot13',\n'COOKIE' => 'foo=a%20phrase; bar=yes%2C%20a%20phrase&;I%20say;',\n'SERVERPORT' => '8080'\n};\n\ncgierror() Retrieving CGI::Simple error messages\nErrors can occur while processing user input, particularly when processing uploaded files. When\nthese errors occur, CGI::Simple will stop processing and return an empty parameter list. You can\ntest for the existence and nature of errors using the cgierror() function. The error messages\nare formatted as HTTP status codes. You can either incorporate the error text into an HTML page,\nor use it as the value of the HTTP status:\n\nmy $error = $q->cgierror;\nif ($error) {\nprint $q->header(-status=>$error);\nprint \"<H2>$error</H2>;\nexit;\n}\n",
                "subsections": []
            },
            "ACCESSOR METHODS": {
                "content": "version() Get the CGI::Simple version info\n$version = $q->version();\n\nThe version() method returns the value of $VERSION\n\nnph() Enable/disable NPH (Non Parsed Header) mode\n$q->nph(1);  # enable NPH mode\n$q->nph(0);  # disable NPH mode\n\nThe nph() method enables and disables NPH headers. See the NPH section.\n\nallparameters() Get the names/values of all parameters\n@allparameters = $q->allparameters();\n\nThe allparameters() method is an alias for param()\n\ncharset() Get/set the current character set.\n$charset = $q->charset(); # get current charset\n$q->charset('utf-42');    # set the charset\n\nThe charset() method gets the current charset value if no argument is supplied or sets it if an\nargument is supplied.\n\ncrlf() Get the system specific line ending sequence\n$crlf = $q->crlf();\n\nThe crlf() method returns the system specific line ending sequence.\n\nglobals() Get/set the value of the remaining global variables\n$globals = $q->globals('FATAL');     # get the current value of $FATAL\n$globals = $q->globals('FATAL', 1 ); # set croak mode on cgierror()\n\nThe globals() method gets/sets the values of the global variables after the script has been\ninvoked. For globals like $POSTMAX and $DISABLEUPLOADS this makes no difference as they must\nbe set prior to calling the new constructor but there might be reason the change the value of\nothers.\n\nauthtype() Get the current authorization/verification method\n$authtype = $q->authtype();\n\nThe authtype() method returns the value of $ENV{'AUTHTYPE'} which should contain the\nauthorization/verification method in use for this script, if any.\n\ncontentlength() Get the content length submitted in a POST\n$contentlength = $q->contentlength();\n\nThe contentlength() method returns the value of $ENV{'AUTHTYPE'}\n\ncontenttype() Get the contenttype of data submitted in a POST\n$contenttype = $q->contenttype();\n\nThe contenttype() method returns the contenttype of data submitted in a POST, generally\n'multipart/form-data' or 'application/x-www-form-urlencoded' as supplied in $ENV{'CONTENTTYPE'}\n\ndocumentroot() Get the document root\n$documentroot = $q->documentroot();\n\nThe documentroot() method returns the value of $ENV{'DOCUMENTROOT'}\n\ngatewayinterface() Get the gateway interface\n$gatewayinterface = $q->gatewayinterface();\n\nThe gatewayinterface() method returns the value of $ENV{'GATEWAYINTERFACE'}\n\npathtranslated() Get the value of path translated\n$pathtranslated = $q->pathtranslated();\n\nThe pathtranslated() method returns the value of $ENV{'PATHTRANSLATED'}\n\nreferer() Spy on your users\n$referer = $q->referer();\n\nThe referer() method returns the value of $ENV{'REFERER'} This will return the URL of the page\nthe browser was viewing prior to fetching your script. Not available for all browsers.\n\nremoteaddr() Get the remote address\n$remoteaddr = $q->remoteaddr();\n\nThe remoteaddr() method returns the value of $ENV{'REMOTEADDR'} or 127.0.0.1 (localhost) if\nthis is not defined.\n\nremotehost() Get a value for remote host\n$remotehost = $q->remotehost();\n\nThe remotehost() method returns the value of $ENV{'REMOTEHOST'} if it is defined. If this is\nnot defined it returns $ENV{'REMOTEADDR'} If this is not defined it returns 'localhost'\n\nremoteident() Get the remote identity\n$remoteident = $q->remoteident();\n\nThe remoteident() method returns the value of $ENV{'REMOTEIDENT'}\n\nremoteuser() Get the remote user\n$remoteuser = $q->remoteuser();\n\nThe remoteuser() method returns the authorization/verification name used for user verification,\nif this script is protected. The value comes from $ENV{'REMOTEUSER'}\n\nrequestmethod() Get the request method\n$requestmethod = $q->requestmethod();\n\nThe requestmethod() method returns the method used to access your script, usually one of\n'POST', 'GET' or 'HEAD' as supplied by $ENV{'REQUESTMETHOD'}\n\nscriptname() Get the script name\n$scriptname = $q->scriptname();\n\nThe scriptname() method returns the value of $ENV{'SCRIPTNAME'} if it is defined. Otherwise it\nreturns Perl's script name from $0. Failing this it returns a null string ''\n\nservername() Get the server name\n$servername = $q->servername();\n\nThe servername() method returns the value of $ENV{'SERVERNAME'} if defined or 'localhost'\notherwise\n\nserverport() Get the port the server is listening on\n$serverport = $q->serverport();\n\nThe serverport() method returns the value $ENV{'SERVERPORT'} if defined or 80 if not.\n\nserverprotocol() Get the current server protocol\n$serverprotocol = $q->serverprotocol();\n\nThe serverprotocol() method returns the value of $ENV{'SERVERPROTOCOL'} if defined or\n'HTTP/1.0' otherwise\n\nserversoftware() Get the server software\n$serversoftware = $q->serversoftware();\n\nThe serversoftware() method returns the value $ENV{'SERVERSOFTWARE'} or 'cmdline' If the\nserver software is IIS it formats your hard drive, installs Linux, FTPs to www.apache.org,\ninstalls Apache, and then restores your system from tape. Well maybe not, but it's a nice\nthought.\n\nusername() Get a value for the user name.\n$username = $q->username();\n\nAttempt to obtain the remote user's name, using a variety of different techniques. This only\nworks with older browsers such as Mosaic. Newer browsers do not report the user name for privacy\nreasons!\n\nTechnically the username() method returns the value of $ENV{'HTTPFROM'} or failing that\n$ENV{'REMOTEIDENT'} or as a last choice $ENV{'REMOTEUSER'}\n\nuseragent() Get the users browser type\n$ua = $q->useragent();          # return the user agent\n$ok = $q->useragent('mozilla'); # return true if user agent 'mozilla'\n\nThe useragent() method returns the value of $ENV{'HTTPUSERAGENT'} when called without an\nargument or true or false if the $ENV{'HTTPUSERAGENT'} matches the passed argument. The\nmatching is case insensitive and partial.\n\nvirtualhost() Get the virtual host\n$virtualhost = $q->virtualhost();\n\nThe virtualhost() method returns the value of $ENV{'HTTPHOST'} if defined or\n$ENV{'SERVERNAME'} as a default. Port numbers are removed.\n\npathinfo() Get any extra path info set to the script\n$pathinfo = $q->pathinfo();\n\nThe pathinfo() method returns additional path information from the script URL. E.G. fetching\n/cgi-bin/yourscript/additional/stuff will result in $q->pathinfo() returning\n\"/additional/stuff\".\n\nNOTE: The Microsoft Internet Information Server is broken with respect to additional path\ninformation. If you use the Perl DLL library, the IIS server will attempt to execute the\nadditional path information as a Perl script. If you use the ordinary file associations mapping,\nthe path information will be present in the environment, but incorrect. The best thing to do is\nto avoid using additional path information in CGI scripts destined for use with IIS.\n\nAccept() Get the browser MIME types\n$Accept = $q->Accept();\n\nThe Accept() method returns a list of MIME types that the remote browser accepts. If you give\nthis method a single argument corresponding to a MIME type, as in $q->Accept('text/html'), it\nwill return a floating point value corresponding to the browser's preference for this type from\n0.0 (don't want) to 1.0. Glob types (e.g. text/*) in the browser's accept list are handled\ncorrectly.\n\naccept() Alias for Accept()\n$accept = $q->accept();\n\nThe accept() Method is an alias for Accept()\n\nhttp() Get a range of HTTP related information\n$http = $q->http();\n\nCalled with no arguments the http() method returns the list of HTTP or HTTPS environment\nvariables, including such things as HTTPUSERAGENT, HTTPACCEPTLANGUAGE, and\nHTTPACCEPTCHARSET, corresponding to the like-named HTTP header fields in the request. Called\nwith the name of an HTTP header field, returns its value. Capitalization and the use of hyphens\nversus underscores are not significant.\n\nFor example, all three of these examples are equivalent:\n\n$requestedlanguage = $q->http('Accept-language');\n$requestedlanguage = $q->http('Acceptlanguage');\n$requestedlanguage = $q->http('HTTPACCEPTLANGUAGE');\n\nhttps() Get a range of HTTPS related information\n$https = $q->https();\n\nThe https() method is similar to the http() method except that when called without an argument\nit returns the value of $ENV{'HTTPS'} which will be true if a HTTPS connection is in use and\nfalse otherwise.\n\nprotocol() Get the current protocol\n$protocol = $q->protocol();\n\nThe protocol() method returns 'https' if a HTTPS connection is in use or the serverprotocol()\nminus version numbers ('http') otherwise.\n\nurl() Return the script's URL in several formats\n$fullurl      = $q->url();\n$fullurl      = $q->url(-full=>1);\n$relativeurl  = $q->url(-relative=>1);\n$absoluteurl  = $q->url(-absolute=>1);\n$urlwithpath = $q->url(-pathinfo=>1);\n$urlwithpathandquery = $q->url(-pathinfo=>1,-query=>1);\n$netloc        = $q->url(-base => 1);\n",
                "subsections": [
                    {
                        "name": "url",
                        "content": "the full form of the URL, including host name and port number\n\nhttp://your.host.com/path/to/script.cgi\n\nYou can modify this format with the following named arguments:\n"
                    },
                    {
                        "name": "-absolute",
                        "content": "If true, produce an absolute URL, e.g.\n\n/path/to/script.cgi\n"
                    },
                    {
                        "name": "-relative",
                        "content": "Produce a relative URL. This is useful if you want to reinvoke your script with different\nparameters. For example:\n\nscript.cgi\n"
                    },
                    {
                        "name": "-full",
                        "content": "Produce the full URL, exactly as if called without any arguments. This overrides the\n-relative and -absolute arguments.\n\n-path (-pathinfo)\nAppend the additional path information to the URL. This can be combined with -full,\n-absolute or -relative. -pathinfo is provided as a synonym.\n\n-query (-querystring)\nAppend the query string to the URL. This can be combined with -full, -absolute or -relative.\n-querystring is provided as a synonym.\n"
                    },
                    {
                        "name": "-base",
                        "content": "Generate just the protocol and net location, as in http://www.foo.com:8000\n\nselfurl() Get the scripts complete URL\n$selfurl = $q->selfurl();\n\nThe selfurl() method returns the value of:\n\n$self->url( '-pathinfo'=>1, '-query'=>1, '-full'=>1 );\n\nstate() Alias for selfurl()\n$state = $q->state();\n\nThe state() method is an alias for selfurl()\n\nCOMPATIBILITY WITH cgi-lib.pl 2.18\nTo make it easier to port existing programs that use cgi-lib.pl all the subs within cgi-lib.pl\nare available in CGI::Simple. Using the functional interface of CGI::Simple::Standard porting is\nas easy as:\n\nOLD VERSION\nrequire \"cgi-lib.pl\";\n&ReadParse;\nprint \"The value of the antique is $in{'antique'}.\\n\";\n\nNEW VERSION\nuse CGI::Simple::Standard qw(:cgi-lib);\n&ReadParse;\nprint \"The value of the antique is $in{'antique'}.\\n\";\n\nCGI:Simple's ReadParse() routine creates a variable named %in, which can be accessed to obtain\nthe query variables. Like ReadParse, you can also provide your own variable via a glob.\nInfrequently used features of ReadParse(), such as the creation of @in and $in variables, are\nnot supported.\n\nYou can also use the OO interface of CGI::Simple and call ReadParse() and other cgi-lib.pl\nfunctions like this:\n\n&CGI::Simple::ReadParse;       # get hash values in %in\n\nmy $q = CGI::Simple->new;\n$q->ReadParse();                # same thing\n\nCGI::Simple::ReadParse(*field); # get hash values in %field function style\n\nmy $q = CGI::Simple->new;\n$q->ReadParse(*field);          # same thing\n\nOnce you use ReadParse() under the functional interface , you can retrieve the query object\nitself this way if needed:\n\n$q = $in{'CGI'};\n\nEither way it allows you to start using the more interesting features of CGI.pm without\nrewriting your old scripts from scratch.\n\nUnlike CGI.pm all the cgi-lib.pl functions from Version 2.18 are supported:\n\nReadParse()\nSplitParam()\nMethGet()\nMethPost()\nMyBaseUrl()\nMyURL()\nMyFullUrl()\nPrintHeader()\nHtmlTop()\nHtmlBot()\nPrintVariables()\nPrintEnv()\nCgiDie()\nCgiError()\n\nCOMPATIBILITY WITH CGI.pm\nI has long been suggested that the CGI and HTML parts of CGI.pm should be split into separate\nmodules (even the author suggests this!), CGI::Simple represents the realization of this and\ncontains the complete CGI side of CGI.pm. Code-wise it weighs in at a little under 30% of the\nsize of CGI.pm at a little under 1000 lines.\n\nA great deal of care has been taken to ensure that the interface remains unchanged although a\nfew tweaks have been made. The test suite is extensive and includes all the CGI.pm test scripts\nas well as a series of new test scripts. You may like to have a look at /t/concur.t which makes\n160 tests of CGI::Simple and CGI in parallel and compares the results to ensure they are\nidentical. This is the case as of CGI.pm 2.78.\n\nYou can't make an omelet without breaking eggs. A large number of methods and global variables\nhave been deleted as detailed below. Some pragmas are also gone. In the tarball there is a\nscript /misc/check.pl that will check if a script seems to be using any of these now non\nexistent methods, globals or pragmas. You call it like this:\n\nperl check.pl <files>\n\nIf it finds any likely candidates it will print a line with the line number, problem\nmethod/global and the complete line. For example here is some output from running the script on\nCGI.pm:\n\n...\n3162: Problem:'$CGI::OS'   local($CRLF) = \"\\015\\012\" if $CGI::OS eq 'VMS';\n3165: Problem:'fillBuffer' $self->fillBuffer($FILLUNIT);\n....\n\nDIFFERENCES FROM CGI.pm\nCGI::Simple is strict and warnings compliant.\n\nThere are 4 modules in this distribution:\n\nCGI/Simple.pm           supplies all the core code.\nCGI/Simple/Cookie.pm    supplies the cookie handling functions.\nCGI/Simple/Util.pm      supplies a variety of utility functions\nCGI/Simple/Standard.pm  supplies a functional interface for Simple.pm\n\nSimple.pm is the core module that provide all the essential functionality. Cookie.pm is a\nshortened rehash of the CGI.pm module of the same name which supplies the required cookie\nfunctionality. Util.pm has been recoded to use an internal object for data storage and supplies\nrarely needed non core functions and/or functions needed for the HTML side of things.\nStandard.pm is a wrapper module that supplies a complete functional interface to the OO back end\nsupplied by CGI::Simple.\n\nAlthough a serious attempt has been made to keep the interface identical, some minor changes and\ntweaks have been made. They will likely be insignificant to most users but here are the gory\ndetails.\n"
                    },
                    {
                        "name": "Globals Variables",
                        "content": "The list of global variables has been pruned by 75%. Here is the complete list of the global\nvariables used:\n\n$VERSION = \"0.01\";\n# set this to 1 to use CGI.pm default global settings\n$USECGIPMDEFAULTS = 0 unless defined $USECGIPMDEFAULTS;\n# see if user wants old  CGI.pm defaults\ndo{ usecgipmglobalsettings(); return } if $USECGIPMDEFAULTS;\n# no file uploads by default, set to 0 to enable uploads\n$DISABLEUPLOADS = 1 unless defined $DISABLEUPLOADS;\n# use a post max of 100K, set to -1 for no limits\n$POSTMAX = 102400 unless defined $POSTMAX;\n# do not include undefined params parsed from query string\n$NOUNDEFPARAMS = 0 unless defined $NOUNDEFPARAMS;\n# separate the name=value pairs with ; rather than &\n$USEPARAMSEMICOLONS = 0 unless defined $USEPARAMSEMICOLONS;\n# only print headers once\n$HEADERSONCE = 0 unless defined $HEADERSONCE;\n# Set this to 1 to enable NPH scripts\n$NPH = 0 unless defined $NPH;\n# 0 => no debug, 1 => from @ARGV,  2 => from STDIN\n$DEBUG = 0 unless defined $DEBUG;\n# filter out null bytes in param - value pairs\n$NONULL  = 1 unless defined $NONULL;\n# set behavior when cgierr() called -1 => silent, 0 => carp, 1 => croak\n$FATAL = -1 unless defined $FATAL;\n\nFour of the default values of the old CGI.pm variables have been changed. Unlike CGI.pm which by\ndefault allows unlimited POST data and file uploads by default CGI::Simple limits POST data size\nto 100kB and denies file uploads by default. $USEPARAMSEMICOLONS is set to 0 by default so we\nuse (old style) & rather than ; as the pair separator for query strings. Debugging is disabled\nby default.\n\nThere are three new global variables. If $NONULL is true (the default) then CGI::Simple will\nstrip null bytes out of names, values and keywords. Null bytes can do interesting things to C\nbased code like Perl. Uploaded files are not touched. $FATAL controls the behavior when"
                    },
                    {
                        "name": "cgi_error",
                        "content": "the defaults to the CGI.pm standard values ie unlimited file uploads via POST for DNS attacks.\nYou can also get the defaults back by using the '-default' pragma in the use:\n\nuse CGI::Simple qw(-default);\nuse CGI::Simple::Standard qw(-default);\n\nThe values of the global variables are stored in the CGI::Simple object and can be referenced\nand changed using the globals() method like this:\n\nmy $value = $q->globals( 'VARNAME' );      # get\n$q->globals( 'VARNAME', 'some value' );    # set\n\nAs with many CGI.pm methods if you pass the optional value that will be set.\n\nThe $CGI::Simple::VARNAME = 'N' syntax is only useful prior to calling the new() constructor.\nAfter that all reference is to the values stored in the CGI::Simple object so you must change\nthese using the globals() method.\n\n$DISABLEUPLOADS and $POSTMAX *must* be set prior to calling the constructor if you want the\nchanges to have any effect as they control behavior during initialization. This is the same a\nCGI.pm although some people seem to miss this rather important point and set these after calling\nthe constructor which does nothing.\n\nThe following globals are no longer relevant and have all been deleted:\n\n$AUTOLOADEDROUTINES\n$AUTOLOADDEBUG\n$BEENTHERE\n$CRLF\n$DEFAULTDTD\n$EBCDIC\n$FH\n$FILLUNIT\n$IIS\n$IN\n$INITIALFILLUNIT\n$JSCRIPT\n$MAC\n$MAXTRIES\n$MODPERL\n$NOSTICKY\n$OS\n$PERLEX\n$PRIVATETEMPFILES\n$Q\n$QUERYCHARSET\n$QUERYPARAM\n$SCRATCH\n$SL\n$SPINLOOPMAX\n$TIMEOUT\n$TMPDIRECTORY\n$XHTML\n%EXPORT\n%EXPORTOK\n%EXPORTTAGS\n%OVERLOAD\n%QUERYFIELDNAMES\n%SUBS\n@QUERYPARAM\n@TEMP\n\nNotes: CGI::Simple uses IO::File->newtmpfile to get tempfile filehandles. These are private by\ndefault so $PRIVATETEMPFILES is no longer required nor is $TMPDIRECTORY. The value that were\nstored in $OS, $CRLF, $QUERYCHARSET and $EBCDIC are now stored in the CGI::Simple::Util object\nwhere they find most of their use. The $MODPERL and $PERLEX values are now stored in our\nCGI::Simple object. $IIS was only used once in pathinfo(). $SL the system specific / \\ : path\ndelimiter is not required as we let IO::File handle our tempfile requirements. The rest of the\nglobals are HTML related, export related, hand rolled autoload related or serve obscure purposes\nin CGI.pm\n"
                    },
                    {
                        "name": "Changes to pragmas",
                        "content": "There are some new pragmas available. See the pragmas section for details. The following CGI.pm\npragmas are not available:\n"
                    },
                    {
                        "name": "-any",
                        "content": ""
                    },
                    {
                        "name": "-compile",
                        "content": ""
                    },
                    {
                        "name": "-nosticky",
                        "content": ""
                    },
                    {
                        "name": "-no_xhtml",
                        "content": ""
                    },
                    {
                        "name": "-private_tempfiles",
                        "content": ""
                    },
                    {
                        "name": "Filehandles",
                        "content": "Unlike CGI.pm which tries to accept all filehandle like objects only \\*FH and $fh are accepted\nby CGI::Simple as file accessors for new() and save(). IO::File objects work fine.\n"
                    },
                    {
                        "name": "Hash interface",
                        "content": "%hash = $q->Vars();     # pack values with \"\\0\";\n%hash = $q->Vars(\",\");  # comma separate values\n\nYou may optionally pass Vars() a string that will be used to separate multiple values when they\nare packed into the single hash value. If no value is supplied the default \"\\0\" (null byte) will\nbe used. Null bytes are dangerous things for C based code (ie Perl).\n\ncgi-lib.pl\nAll the cgi-lib.pl 2.18 routines are supported. Unlike CGI.pm all the subroutines from\ncgi-lib.pl are included. They have been GOLFED down to 25 lines but they all work pretty much\nthe same as the originals.\n\nCGI::Simple COMPLETE METHOD LIST\nHere is a complete list of all the CGI::Simple methods.\n\nGuts (hands off, except of course for new)\ninitializeglobals\nusecgipmglobalsettings\nstoreglobals\nimport\nresetglobals\nnew\ninitialize\nreadparse\nparseparams\naddparam\nparsekeywordlist\nparsemultipart\nsavetmpfile\nreaddata\n"
                    },
                    {
                        "name": "Core Methods",
                        "content": "param\naddparam\nparamfetch\nurlparam\nkeywords\nVars\nappend\ndelete\nDelete\ndeleteall\nDeleteall\nupload\nuploadinfo\nquerystring\nparsequerystring\nparsekeywordlist\n"
                    },
                    {
                        "name": "Save and Restore from File Methods",
                        "content": "initfromfile\nsave\nsaveparameters\n"
                    },
                    {
                        "name": "Miscellaneous Methods",
                        "content": "urldecode\nurlencode\nescapeHTML\nunescapeHTML\nput\nprint\n"
                    },
                    {
                        "name": "Cookie Methods",
                        "content": "cookie\nrawcookie\n"
                    },
                    {
                        "name": "Header Methods",
                        "content": "header\ncache\nnocache\nredirect\n"
                    },
                    {
                        "name": "Server Push Methods",
                        "content": "multipartinit\nmultipartstart\nmultipartend\nmultipartfinal\n"
                    },
                    {
                        "name": "Debugging Methods",
                        "content": "readfromcmdline\nDump\nasstring\ncgierror\n\ncgi-lib.pl Compatibility Routines - all 2.18 functions available\nshiftifref\nReadParse\nSplitParam\nMethGet\nMethPost\nMyBaseUrl\nMyURL\nMyFullUrl\nPrintHeader\nHtmlTop\nHtmlBot\nPrintVariables\nPrintEnv\nCgiDie\nCgiError\n"
                    },
                    {
                        "name": "Accessor Methods",
                        "content": "version\nnph\nallparameters\ncharset\ncrlf                # new, returns OS specific CRLF sequence\nglobals             # get/set global variables\nauthtype\ncontentlength\ncontenttype\ndocumentroot\ngatewayinterface\npathtranslated\nreferer\nremoteaddr\nremotehost\nremoteident\nremoteuser\nrequestmethod\nscriptname\nservername\nserverport\nserverprotocol\nserversoftware\nusername\nuseragent\nvirtualhost\npathinfo\nAccept\naccept\nhttp\nhttps\nprotocol\nurl\nselfurl\nstate\n\nNEW METHODS IN CGI::Simple\nThere are a few new methods in CGI::Simple as listed below. The highlights are the"
                    },
                    {
                        "name": "parse_query_string",
                        "content": "The nocache() method adds an expires now directive and the Pragma: no-cache directive to the\nheader to encourage some browsers to do the right thing. PrintEnv() from the cgi-lib.pl routines\nwill dump an HTML friendly list of the %ENV and makes a handy addition to Dump() for use in\ndebugging. The upload method now accepts a filepath as an optional second argument as shown in\nthe synopsis. If this is supplied the uploaded file will be written to there automagically.\n"
                    },
                    {
                        "name": "Internal Routines",
                        "content": "initializeglobals()\nusecgipmglobalsettings()\nstoreglobals()\ninitialize()\ninitfromfile()\nreadparse()\nparseparams()\naddparam()\nparsekeywordlist()\nparsemultipart()\nsavetmpfile()\nreaddata()\n"
                    },
                    {
                        "name": "New Public Methods",
                        "content": "addparam()             # adds a param/value(s) pair +/- overwrite\nuploadinfo()           # uploaded files MIME type and size\nurldecode()            # decode s url encoded string\nurlencode()            # url encode a string\nparsequerystring()    # add QUERYSTRING data to $q object if 'POST'\nnocache()              # add both the Pragma: no-cache\n# and Expires/Date => 'now' to header\n\ncgi-lib.pl methods added for completeness\nshiftifref()         # internal hack reminiscent of selfordefault :-)\nMyBaseUrl()\nMyURL()\nMyFullUrl()\nPrintVariables()\nPrintEnv()\nCgiDie()\nCgiError()\n"
                    },
                    {
                        "name": "New Accessors",
                        "content": "crlf()                  # returns CRLF sequence\nglobals()               # global vars now stored in $q object - get/set\ncontentlength()        # returns $ENV{'CONTENTLENGTH'}\ndocumentroot()         # returns $ENV{'DOCUMENTROOT'}\ngatewayinterface()     # returns $ENV{'GATEWAYINTERFACE'}\n\nMETHODS IN CGI.pm NOT IN CGI::Simple\nHere is a complete list of what is not included in CGI::Simple. Basically all the HTML related\nstuff plus large redundant chunks of the guts. The check.pl script in the /misc dir will check\nto see if a script is using any of these.\n"
                    },
                    {
                        "name": "Guts - rearranged, recoded, renamed and hacked out of existence",
                        "content": "initializeglobals()\ncompile()\nexpandtags()\nselfordefault()\nselforCGI()\ninit()\ntofilehandle()\nsaverequest()\nparseparams()\naddparameter()\nbinmode()\nmaketagfunc()\nAUTOLOAD()\ncompile()\nsetupsymbols()\nnewMultipartBuffer()\nreadfromclient()\nimportnames()     # I dislike this and left it out, so shoot me.\n\nHTML Related\nautoEscape()\nURLENCODED()\nMULTIPART()\nSERVERPUSH()\nstarthtml()\nstyle()\nscript()\nendhtml()\nisindex()\nstartform()\nstartform()\nendmultipartform()\nstartmultipartform()\nendform()\nendform()\ntextfield()\ntextfield()\nfilefield()\npasswordfield()\ntextarea()\nbutton()\nsubmit()\nreset()\ndefaults()\ncomment()\ncheckbox()\ncheckboxgroup()\ntableize()\nradiogroup()\npopupmenu()\nscrollinglist()\nhidden()\nimagebutton()\nnosticky()\ndefaultdtd()\n"
                    },
                    {
                        "name": "Upload Related",
                        "content": "CGI::Simple uses anonymous tempfiles supplied by IO::File to spool uploaded files to.\n\nprivatetempfiles() # automatic in CGI::Simple\ntmpFileName()       # all upload files are anonymous\nuploadInfo()        # relied on FH access, replaced with uploadinfo()\n\nReally Private Subs (marked as so)\npreviousordefault()\nregisterparameter()\ngetfields()\nsetvaluesandlabels()\ncompileall()\nasString()\ncompare()\n"
                    },
                    {
                        "name": "Internal Multipart Parsing Routines",
                        "content": "readmultipart()\nreadHeader()\nreadBody()\nread()\nfillBuffer()\neof()\n"
                    }
                ]
            },
            "EXPORT": {
                "content": "Nothing.\n",
                "subsections": []
            },
            "AUTHOR INFORMATION": {
                "content": "Originally copyright 2001 Dr James Freeman <jfreeman@tassie.net.au> This release by Andy\nArmstrong <andy@hexten.net>\n\nThis package is free software and is provided \"as is\" without express or implied warranty. It\nmay be used, redistributed and/or modified under the terms of the Perl Artistic License (see\nhttp://www.perl.com/perl/misc/Artistic.html)\n\nAddress bug reports and comments to: andy@hexten.net. When sending bug reports, please provide\nthe version of CGI::Simple, the version of Perl, the name and version of your Web server, and\nthe name and version of the operating system you are using. If the problem is even remotely\nbrowser dependent, please provide information about the affected browsers as well.\n\nAddress bug reports and comments to: andy@hexten.net\n",
                "subsections": []
            },
            "CREDITS": {
                "content": "Lincoln D. Stein (lstein@cshl.org) and everyone else who worked on the original CGI.pm upon\nwhich this module is heavily based\n\nBrandon Black for some heavy duty testing and bug fixes\n\nJohn D Robinson and Jeroen Latour for helping solve some interesting test failures as well as\nPerlmonks: tommyw, grinder, Jaap, vek, erasei, jlongino and stridercorinth\n\nThanks for patches to:\n\nEwan Edwards, Joshua N Pritikin, Mike Barry, Michael Nachbaur, Chris Williams, Mark Stosberg,\nKrasimir Berov, Yamada Masahiro\n",
                "subsections": []
            },
            "LICENCE AND COPYRIGHT": {
                "content": "Copyright (c) 2007, Andy Armstrong \"<andy@hexten.net>\". All rights reserved.\n\nThis module is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See perlartistic.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "CGI, CGI::Simple::Standard, CGI::Simple::Cookie, CGI::Simple::Util, CGI::Minimal\n",
                "subsections": []
            }
        }
    }
}