Script languages have many uses, and CGI has a firm place among them. awful's CGI mode is aimed to make life a little bit easier for those brave enough to consider writing such a script in this language.
#!/usr/bin/awful-cgi <?yuk :writeln s"Hello world!" ?>
When run in CGI mode, file parsing differs significantly from the classical approach - but if you ever worked with PHP, you will feel at home. The main difference when using CGI mode is that awful code must be put inside <?yuk ?>
tags. Everything outside these tags will be treated as strings to output - which allows you to easily embed awful inside HTML. Note that there is but one minor exception to this rule - if the first line of the script contains a shebang (#!
), this line will NOT be output.
One important thing to remember when creating a CGI script is to correctly output HTTP headers. awful-cgi contains several facilities to make this easier for you.
:http-header
function, which allows you to control which headers are printed, along with their contents.wikipage modified on 2014/0601/2317