SIMPOL Documentation

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

PropertyTypeDescription
_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.
typetype 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
NameDefaultTypeDescription
nameNonestring The name of the variable for which to retrieve the value

output()

Prototype

cgicallvar.output ( string string, integer charsize, boolean 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
NameDefaultTypeDescription
stringNonestringThe text (or other data) to be output
charsize2integerThe number of bytes per character, which must be greater than 0
lbo.trueboolean 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
NameDefaultTypeDescription
length.infintegerThe 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 name, integer 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
NameDefaultTypeDescription
nameNone The name of the key value to retrieve
indexNoneinteger 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
NameDefaultTypeDescription
nameNonestringThe name of the cookie whose value is to be retrieved

outputcookie()

Prototype

cgicallvar.outputcookie ( string name, string value, string path, integer 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
NameDefaultTypeDescription
nameNonestringThe name of the cookie to create
valueNone.nulThe value part of the cookie will be empty
stringThe value to put in the cookie
path.nul.nulNo 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.