Chapter 8. The CGI/ISAPI/FastCGI Component
cgicall
Description
An object of type cgicall is passed to the entry function of a CGI (or ISAPI) smpol program. The object is used to get variable values, get and set cookies and perform other CGI style I/O tasks.
Object Value
Objects of type cgicall have no value, and it is an error to try to get or set this value.
Properties
Property | Type | Description |
---|---|---|
_ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. |
__ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property. |
type | type | Specifies the cgicall type object. |
Methods
getvariable()
Prototype
cgicallvar
.getvariable
(
string
)
name
Description
Gets the value of the environment variable or server variable of
the specified name, if it exists. If the variable cannot be found
then .nul
is returned.
Parameters
Name | Default | Type | Description |
---|---|---|---|
name | None | string | The name of the variable for which to retrieve the value |
output()
Prototype
cgicallvar
.output
(
string
,
integer string
,
boolean charsize
)
lbo
Description
Outputs data from a CGI program. The output can be any string but normally this will be ASCII text such as HTML.
Parameters
Name | Default | Type | Description |
---|---|---|---|
string | None | string | The text (or other data) to be output |
charsize | 2 | integer | The number of bytes per character, which must be greater than 0 |
lbo | .true | boolean |
Indicates whether characters have been stored with the least
significant byte first (.true ) or with the most significant
byte first (.false ).
|
input()
Prototype
cgicallvar
.input
(
integer
)
length
Description
Gets data from the standard input to a CGI program. It is always assumed that one byte of input is one character.
Parameters
Name | Default | Type | Description |
---|---|---|---|
length | .inf | integer | The whole of the available input will be read |
integer | The maximum number of bytes of input to read. If this is greater than the number of bytes available then a shorter string than specified will be returned. If there is no more available input then the empty string will be returned. |
keyvalue()
Prototype
cgicallvar
.keyvalue
(
string
,
integer name
)
index
Description
Gets the value of a key from the submitted input. An index can be specified to retrieve values for keys where more than one value is submitted.
Parameters
Name | Default | Type | Description |
---|---|---|---|
name | None | The name of the key value to retrieve | |
index | None | integer | The 1-based index of the value to retrieve for the specified key |
getcookie()
Prototype
cgicallvar
.getcookie
(
string
)
name
Description
Gets the value a cookie sent with the HTTP request. If no cookie
of the specified name has been sent, then .nul
is returned.
Parameters
Name | Default | Type | Description |
---|---|---|---|
name | None | string | The name of the cookie whose value is to be retrieved |
outputcookie()
Prototype
cgicallvar
.outputcookie
(
string
,
string name
,
string value
,
integer path
)
expires
Description
Outputs a string which is intended to be a cookie in an HTTP header. It is the responsibility of the programmer to ensure that the string is output at the appropriate place to be part of the HTTP header information.
Parameters
Name | Default | Type | Description |
---|---|---|---|
name | None | string | The name of the cookie to create |
value | None | .nul | The value part of the cookie will be empty |
string | The value to put in the cookie | ||
path | .nul | .nul | No path part will be added to the cookie |
string | The contents of the path part of the cookie. If the empty string is specified then no path part will be output | ||
expires | .nul | .nul | No expiry information will be added to the cookie, so it will expire at the end of the session |
integer | The expiry date and time of the cookie, specified in microseconds since midnight at the beginning of 1/1/0001, as with the value of a datetime object. |