Basic application setup
Prior to start writing a new CSA application, the very first thing you need to do is to create the proper structure of files and directories where your application will be located on the Web server. The CSA distribution tarball contains an example application. To begin with, if you want to set-up such an application you must copy the whole content of the
example/ directory in your
$HOME/.csa/example/ and then apply your local customizations to
$HOME/.csa/example/csa.rc . The following explanation will show how to setup and play with with such example application, which consists of just a few programs (or
methods), one of which is the classical "hello-world". As you will see in the rest of this manual, CSA makes use of a number of naming conventions to identify its files and objects. One of such convention is to identify a single program by its file-name, prefixed by the name of the application it belongs to. In our example, the application is
example , and the program is
hello-world . So the fully-qualified name of our program will be
example.hello-world. The purpose of our program is to display the usual "Hello World" message on a Web page, whenever it is called by the user through a Web browser, or through some other Web client program.
Let's assume that the non-privileged system account under which your Web server, and thus your CGI programs, runs is
goofy , that its HOME directory (that we will usually refer to as
$HOME ) is
/var/www/ and that your CGI programs leave in
/usr/lib/cgi-bin/ .
First, you need to copy the CSA shell script from
/usr/local/csa/bin/CSA into
/usr/lib/cgi-bin/ . Then edit
/usr/local/csa/etc/csa.rc and change "logname = jsmith" into "logname = goofy". As already stated, your knowledge of the rc shell syntax is assumed here. Make sure that
tmpdir points at an axisting directory and that the latter is writable by the
goofy user. See also
this link on how to create secure temporary files and directories.
In the explanation that follows I will assume that you placed the CSA example application into
$HOME/.csa/example/ . Should you prefer to place your CSA applications in a different location, edit the "libstem =" definition in
/usr/local/csa/etc/csa.rc accordingly. The application-specific location
$HOME/.csa/example will often be identified simply as
$CSA_ROOT throughout this text.
Why did I choose a hidden directory name, such as
.csa/ , for the user-level components of CSA ? Well, I see CSA as an extension of the shell command-line to the Web, a way of taking to the Web common shell-level UNIX commands and applications. It seems therefore logical to me to consider such ability a per-user configuration matter, and user profiling stuff is usually written into hidden files and folders in one's $HOME directory. Of course this view may be questionable.
Trackbacks (1) |
New trackback |
Print
|