$query = new CGI(INPUTFILE);
If you provide a file handle to the new
method, it will read parameters from the file (or
STDIN, or whatever). The file can be in any of the forms describing below under debugging (i.e. a series of newline delimited
TAG=VALUE pairs will work). Conveniently, this type of file is created by the save
method (see below). Multiple records can be saved and restored.
Perl purists will be pleased to know that this syntax accepts references to file handles, or even references to filehandle globs, which is the ``official'' way to pass a filehandle:
$query = new CGI(\*STDIN);
You can also initialize the query object from an associative array reference:
$query = new CGI( {'dinosaur'=>'barney', 'song'=>'I love you', 'friends'=>[qw/Jessica George Nancy/]} );
or from a properly formatted, URL-escaped query string:
$query = new CGI('dinosaur=barney&color=purple');
To create an empty query, initialize it from an empty string or hash:
$empty_query = new CGI(""); -or- $empty_query = new CGI({});