The following methods are supported by CGI.pm.
| Accept |
$query->accept(['content_type'])
Returns a list of media types that the browser accepts.
| append |
$query->append(-name=>'name',-values=>'value')
Appends a value or list of values to the named parameter.
| autoEscape |
$query->autoEscape(undef)
Turns off autoescaping of form elements.
| button |
print $query->button('name','function')
Generates a JavaScript button.
Using named parameters, the syntax is:
print $query->button(-name=>'name',
-value=>'label',
-onClick=>"function");| checkbox |
print $query->checkbox('name' [,'checked','value','label'])
Generates a single checkbox.
Using named parameters, the syntax is:
print $query->checkbox(-name=>'name',
-checked=>'checked',
-value=>'value',
-label=>'label',
-onClick=>function);
| checkbox_group |
print $query->checkbox_group('name', \@list [,selected, 'true',\%labelhash ])
Generates a list of checkbox elements.
Using named parameters, the syntax is:
print $query->checkbox_group(-name=>'name',
-values=>\@list,
-default=>selected,
-linebreak=>'true',
-labels=>\%labelhash,
-columns=>n,
-columnheader=>'string',
-rows=>m,
-rowheader=>'string',
-onClick=>function);
| cookie |
$cookie=$query->cookie('name')
Defines or retrieves a cookie. See also header .
Using named parameters, the syntax is:
$cookie = $query->cookie(-name=>'name',
-value=>'value',
-expires=>'expcode',
-path=>'partial_url',
-domain=>'domain_name',
-secure=>1);
print $query->header(-cookie=>$cookie);| defaults |
print $query->defaults('label')
Generates a button that resets the form to its defaults. See also reset.
| delete |
$query->delete('parameter')
Deletes a parameter.
| delete_all |
$query->delete_all( )
Deletes the entire CGI object.
| dump |
print $query->dump([true])
Dumps all name/value pairs as an HTML list.
| end_html |
print $query->end_html( )
Ends an HTML document.
| filefield |
print $query->filefield('name' [,'default',size,maxlength])
Generates a file upload field for Netscape browsers.
Using named parameters, the syntax is:
print $query->textfield(-name=>'name',
-default=>'value',
-size=>size,
-maxlength=>maxlength,
-override=>1,
-onChange=>function,
-onFocus=>function,
-onBlur=>function,
-onSelect=>function);| header |
print $query->header([content_type, status, headers])
Generates the HTTP header for the document.
Using named parameters, the syntax is:
print $query->header(-type=>'content_type',
-nph=>1,
-status=>'status_code',
-expires=>'expcode',
-cookie=>'cookie',
-target=>'frame',
-header=>'value');| hidden |
print $query->hidden('name', 'value' [,'value'... ])
Generates a hidden text field.
Using named parameters, the syntax is:
print $query->hidden(-name=>'name',
-default=>'value');With named parameters, the value can also be represented as a reference to an array, such as:
print $query->hidden(-name=>'name',
-default=>['value1', 'value2', ... ]);| image_button |
print $query->image_button('name','url' [,'align'])
Generates a clickable image map.
Using named parameters, the syntax is:
print $query->image_button(-name=>'name',
-src=>'url',
-align=>'align',
-onClick=>function);| import_names |
$query->import_names('package')
Creates variables in the specified package. Called import in older versions of CGI.pm.
| isindex |
print $query->isindex([action])
Generates an <ISINDEX> tag.
Using named parameters, the syntax is:
print $query->isindex(-action=>$action);
| keywords |
@keyarray = $query->keywords( )
Retrieves keywords from an <ISINDEX> search.
| nph |
nph(1)
Treats a CGI script as a no-parsed-header (NPH) script.
| param |
@name = $query->param([parameter[newvalue1, newvalue2,...] ])
Gets or sets parameter names.
Using named parameters, the syntax is:
$query->param(-name=>'parameter',
-value=>'newvalue');
or:
$query->param(-name=>'parameter',
-values=>'newvalue1', 'newvalue2', ...);
| password_field |
print $query->password_field('name' [,'value',size,maxlength])
Generates a password input field.
Using named parameters, the syntax is:
print $query->password_field(-name=>'name',
-default=>'value',
-size=>size,
-maxlength=>maxlength,
-override=>1,
-onChange=>function,
-onFocus=>function,
-onBlur=>function,
-onSelect=>function);
| path_info |
path_info( )
Returns extra path information.
| path_translated |
path_translated( )
Returns translated extra path information.
| popup_menu |
print $query->popup_menu('name', \@array [,'selected', \%labelhash])
Generates a pop-up menu.
%labels = ('UPS'=>'United Parcel Service (UPS)',
'FedExO'=>'Federal Express Overnight - 10AM delivery',
'FedExS'=>'Federal Express Standard - 2PM delivery',
'FedEx2'=>'Federal Express 2nd Day Delivery');
print $query->popup_menu('delivery_method',
['UPS', 'FedExO', 'FedExS', 'FedEx2'],
'FedExO',
\%labels);
Using named parameters, the syntax is:
print $query->popup_menu(-name=>'name',
-values=>\@array,
-default=>'selected',
-labels=>\%labelhash,
-onChange=>function,
-onFocus=>function,
-onBlur=>function);
| radio_group |
print $query->radio_group('name', \@list [, selected, 'true', \%label])
Generates a set of radio buttons.
Using named parameters, the syntax is:
print $query->radio_group(-name=>'name',
-values=>\@list,
-default=>'selected',
-linebreak=>'true',
-labels=>\%labelhash,
-columns=>n,
-columnheader=>'string',
-rows=>m,
-rowheader=>'string');| raw_cookie |
raw_cookie( )
Returns the value of the HTTP_COOKIE header.
| ReadParse |
ReadParse( )
Creates a hash named %in containing query information. Used for backward compatibility with the Perl4 cgi-lib.pl.
| redirect |
print $query->redirect('url')
Generates a header for redirecting the browser.
Using named parameters, the syntax is:
print $query->redirect(-uri=>'url',
-nph=>1);| referer |
referer( )
Returns the referring URL.
| remote_host |
remote_host( )
Returns the remote hostname or IP address, depending on the configuration of the server.
| remote_user |
remote_user( )
Returns the username supplied for authorization.
| request_method |
request_method( )
Returns the request method.
| reset |
print $query->reset
Generates a button that resets the form to its initial values. See also defaults.
| save |
$query->save(filehandle)
Saves the form to the specified filehandle, to be read back with the new constructor.
| script_name |
script_name( )
Returns the current partial URL.
| scrolling_list |
print $query->scrolling_list('name',\@list [,selected,size,'true', \%labelhash])
Generates a scrolling list.
Using named parameters, the syntax is:
print $query->scrolling_list(-name=>'name',
-values=>\@listarray,
-default=>selected,
-size=>size,
-multiple=>'true',
-labels=>\%labelhash,
-onChange=>function,
-onFocus=>function,
-onBlur=>function);| self_url |
$url = $query->self_url
Returns the URL of the current script with all its state information intact.
| start_html |
print $query->start_html(['title', 'email', 'base', attribute='value'])
Generates <HTML> and <BODY> tags.
Using named parameters, the syntax is:
print $query->start_html(-title=>'title',
-author=>'email_address',
-base=>'true',
-xbase=>'url',
-meta=>{'metatag1'=>'value1',
'metatag2'=>'value2'},
-script=>'$script',
-onLoad=>'$function',
-onUnload=>'$function',
attribute=>'value');| startform |
print $query->startform([method, action, encoding])
Generates a <FORM> tag.
Using named parameters, the syntax is:
print $query->startform(-method=>$method,
-action=>$action,
-encoding=>$encoding,
-name=>$name,
-target=>frame,
-onSubmit=>function);| start_multipart_form |
print $query->start_multipart_form([method, action])
Generates <HTML> and <BODY> tags. Same as startform but assumes multipart/form-data encoding as the default.
| submit |
print $query->submit([ 'label','value' ])
Generates a submit button.
Using named parameters, the syntax is:
print $query->submit(-name=>'name',
-value=>'value',
-onClick=>function);| textarea |
print $query->textarea('name' [,'value',rows,columns ])
Generates a large multiline text input box.
Using named parameters, the syntax is:
print $query->textarea(-name=>'name',
-default=>'value',
-rows=>rows,
-columns=>columns,
-override=>1,
-onChange=>function,
-onFocus=>function,
-onBlur=>function,
-onSelect=>function);| textfield |
print $query->textfield('name' [,'value', size, maxlength])
Generates a text input field.
Using named parameters, the syntax is:
print $query->textfield(-name=>'name',
-default=>'value',
-size=>size,
-maxlength=>maxlength,
-override=>1,
-onChange=>function,
-onFocus=>function,
-onBlur=>function,
-onSelect=>function);
| url |
url = $query->url
Returns a URL of the current script without query information.
| use_named_parameters |
use_named_parameters( )
Specifies that functions should take named parameters.
| user_agent |
$query->user_agent( [string] )
Returns the value of the HTTP_USER_AGENT header.