<Web Specifics>

[ get | post | match | refresh | sendmail | url | dir | userid ]


Get and Post

exp ::= get ( exp )
exp ::= get ( exp ) [ cgiinput_list ]
The expression is evaluated to a string designating a URL. The left hand sides in the assignments in the cgiinput_list will be the names and the right hand sides, the values. This URL is fetched dynamically from the Internet, supplying the string arguments specified in the cgiinput_list using the GET method. The result is a string containing the document fetched (it cannot be of type html since we do not statically know its flow type).

exp ::= post ( exp )
exp ::= post ( exp ) [ cgiinput_list ]
The expression is evaluated to a string designating a URL. The left hand sides in the assignments in the cgiinput_list will be the names and the right hand sides, the values. This URL is fetched dynamically from the Internet, supplying the string arguments specified in the cgiinput_list using the POST method. The result is a string containing the document fetched (it cannot be of type html since we do not statically know its flow type).


Match

exp ::= match ( exp , exp ) [ getinput_list ]

There are three variants of the match construct. The first argument must always be a string, namely the string on which the match construct will operate. The second argument can either be an html document template with a number of gaps, a format with a number of record constructs, or a string. The expressions in the expression list must all be assignments. The right hand sides will denote gaps or record constructs and the left hand sides will denote variables that will be assigned the values matched in the gaps or record constructs.

Matching against html document templates:
The string is matched against the html document template, requiring the non-gap constituents (text and fields) to match completely and treating the gaps as "wildcards" that will match anything. The construct employes an eager strategy to find a match and if successful, the assignments in the expression list will take place. The expressions on the right hand sides of the assignments must be identifiers naming the gaps of the document, evaluating to the parts of the string they matched. The string typically comes from a get or a post operation and can thus be used to extract certain patterns in a document gotten from the internet. The construct will return a boolean signalling whether a match was possible or not.

Matching against regular expression formats:
The string is matched against the regular expression format, any record constructs will record what their internal regular expressions matched. The expressions on the right hand sides of the assignments must be identifiers naming the recording constructs in the format, evaluating to the parts of the string they matched. The construct will return a boolean signalling whether a match was possible or not.

Matching against dynamic regexps:
If the second argument is a "string", it is assumed to be some (even dynamically) generated Unix-style regexp with which the first (string) argument is checked to comply. "Match" returns "true" if and only if this string matches the regexp. Three meta-variables may be ``received'' from the "match" construction, "start" (index of start matching point), "stop" (stop index), and "status" (error code if the second argument didn't parse). The regexps are as in the gnu-c library "regexp.h" (the error codes also come from here).


Miscellaneous

mode ::= refresh ( exp )
This construct sets the auto refresh rate used when documents are flashed, using the flash statement. The expression must evaluate to an integer which becomes the new refresh rate in seconds. The area of effect is either an entire service, a session, or a single flash statement, depending on where the mode was applied.

exp ::= sendmail ( exp , exp )
This construct sends an email. The first argument must be a relation or a vector with a schema with two attributes named "name" and "value". The second argument is a string containing the actual message to be sent. The relation/vector part will be used to generate the header information in the email and should for this reason at least contain "to", "subject" and "from" tuples with corresponding values.

exp ::= url
exp ::= url id ( exp_list )
The url expression (without arguments) returns a string which is the URL of the HTML reply directory associated with the current session. The variant with arguments will take an identifier naming a session in the current service plus a list of appropriate arguments. The construct will not call the session with the arguments, but instead provide an html string that does (using the GET method) when accessed by a browser.

exp ::= dir
The dir expression returns a string which is the directory of the HTML reply directory associated with the current session. It is typically used for manipulating files in the session's private directory.

exp ::= userid
This expression allows a service to remember the identity of a client beyond a session run through the use of a cookie. If the expression is present somewhere in a service, the service will when started generate a random string which is set as a cookie by the runtime system. The expression userid will henceforth return the value of this string.

exp ::= getcookie ( exp )
This built-in function takes a string argument naming a cookie and returns the value of this cookie. The function returns the empty string if there is no cookie with the given name.

exp ::= setcookie ( exp , exp )
This built-in function takes two string arguments. The cookie named by the first argument is set to the value designated by the second argument. However, the cookie setting will only take effect at the next show or exit statement.


bigwig@brics.dk
Last updated: November 2, 2001
Valid HTML 4.01!