CGI module
This module provides a simple low-level CGI application interface, for development of small web applications and prototypes. For larger web applications, the Webapp module may be more suitable due to tighter integration with HTMLDocument.
This module now includes experimental support for AJAX programming. These functions are likely to change in future releases.
Type Synonyms
HTML=String
Data types
- CGI::AjaxAction - Ajax action to take when an event occurs
- CGI::AjaxData - Ajax data requests
- CGI::AjaxEvent - Events to be handled by Ajax actions
Exceptions
- BadHeader - Malformed HTTP header
- IllegalHandler - Illegal handler
- UnexpectedType - Unexpected type
- UnrecognisedVariable - Unrecognised variable
- ValueOutOfRange - Variable outside expected range
Functions
- Void addHandler(String shortName,Void(a) fn,a dat,Bool prepost=true) - Register a handler to get a short URL
- HTML ajaxHeader() - Some basic javascript for handling Ajax calls
- String ajaxTag(AjaxEvent h,AjaxAction act,String resultID="",[AjaxData] extras=[]) - Get tag information for linking an ajax call to an event on a tag
- String ajaxTagData(AjaxAction act,String resultID="",[AjaxData] extras=[]) -
- HTML checkBox(String name,Bool def=false,String id="",String extra="") - Make a checkbox.
- Bool checked(String name) - Return whether a checkbox was checked.
- HTML closeForm() - End a form
- Void content(HTML c) - Add new content
- String expandQuery(String shortName) - Look up a short name to get a fully expanded query string.
- HTML fileFormHandler(Void(a) fn,a dat,Bool prepost=true) - Set up a file upload form.
- Void flushAll() - Output all headers and content.
- Void flushContent() - Output the content.
- Void flushHeaders() - Output headers.
- HTML formHandler(Void(a) fn,a dat,Bool prepost=true) - Set up a form.
- [String] getAjaxData() - Get additional data sent to an Ajax request
- HTML goDefault(String inf) - Link to the default function.
- Void header(String h) - Add a HTTP header
- String htmlEscape(String x) - Encodes HTML special chars.
- Float httpFloat(String v) - Return the floating-point number in a GET/POST variable.
- Int httpInt(String v) - Return the integer in a GET/POST variable.
- HTML imageHandler(Void(a) fn,a dat,String alt,Int width=-1,Int height=-1,String attribs="") - Embed an image.
- HTML linkHandler(Void(a) fn,a dat,String inf,[Pair<String, String> ] others=[],Bool prepost=true) - Create a hyperlink.
- HTML linkURL(Void(a) fn,a dat,[Pair<String, String> ] others=[],Bool prepost=true) -
- HTML passVar(String httpvar,String value) - Pass a variable to a form.
- HTML passwordBox(String name,Int len=20,String id="",String extra="") - Create a password input field.
- HTML radio(String name,String val,Bool set=false,String id="",String extra="") - Make a radio button.
- Void replaceContent(HTML str,HTML new) - Replace a string in the current output.
- HTML reset(String text,String id="",String extra="") - Create a reset button.
- Float safeFloat(String x,Float min,Float max) - Convert a string to a Float.
- Int safeInt(String x,Int min,Int max) - Convert a string to an Int.
- HTML selBox(String name,Int len,[String] opts,String def="",String id="",String extra="") - Create a selection box.
- Void setCookie(String name,String value) - Set a cookie
- HTML submit(String text,String id="",String extra="") - Create a submit button.
- String submitUsed() - Get the last submit button
- HTML table([String] titles,[[String]] rows,String tableattribs="",String headattribs="",String dataattribs="") - Output a table.
- HTML textArea(String name,Int width,Int height,String value="",String id="",String extra="") - Create a text area input field.
- HTML textBox(String name,String value="",Int len=20,String id="",String extra="") - Create a text input field.
- HTML uploadButton(String name,String id="",String extra="") - Create a file upload field.