LibCGI 1.0 [ANN]

Rodney Tamblyn rodneyta at telpacific.com.au
Thu Jan 22 22:08:02 EST 2004


Monte Guilding and I are pleased to announce the availability of our 
LibCGI package, as demonstrated by Jacqueline at the Revolution 
conference recently.  LibCGI  is now available for download from:

http://www.sweattechnologies.com/rev/
http://www.infiny.co.nz/developer/LibCGI%201.0.zip

We are releasing this to the Revolution community as freeware.

LibCGI simplifies CGI scripting in Revolution (and Metacard).  It 
provides a standard way to process data from users,  whether submitted 
via web page forms or URL parameters.

Scripting your own CGIs is very simple with LibCGI.  After 
configuration on your web server, all you need to do is create a 
Revolution stack containing an "on libraryStack" handler.  All data 
from the user is stored in an array.  This will be called when the web 
server calls a function in the stack.

A simple example of calling a libCGI function is illustrated in the 
following URL and response:
http://yourdomain.com/cgi-bin/form.cgi?stack=hello&cmd=hello

In the Hello.rev stack you would place the following handler

global gRequestA

on libraryStack
   put gRequestA["address"] into tAddress
   switch gRequestA["cmd"]
     case "hello"
     libCGI_Response "hello world"
     break
  default
     libCGI_Response "command not understood"&& gRequestA["cmd"]
   break
  end switch
end libraryStack

Calling the URL returns "Hello World"

State information can be handled through LibCGI support for getting and 
setting cookies on the remote client's web browser.

To simplify development, LibCGI features several useful error reporting 
features.  When a script in a CGI stack fails LibCGI can generate a 
result page containing the error, submitted information from user, and 
Revolution variables.  Errors can also be logged to the system logs. To 
assist in debugging you can watch CGI scripts dynamically as they 
execute in the web server, by placing libCGI console logging messages 
in your scripts.  These can be viewed in OSX using the Console 
application.

CGI stacks may call other stacks. One of the supplied example CGI 
stacks demonstrates sending an email reply to a request using the 
libSMTP stack.  When file and file permissions are correctly 
configured, LibCGi scripts can also read and write files on the server.

The documentation explains how advanced users can configure Apache to 
support server side includes, allowing generation of dynamic web pages 
where portions of the page have been generated by Revolution CGI calls.

Documentation and several examples stacks are included in the download.

Known Issues:

(i) Console logging script has a known bug - it is necessary to escape 
special characters in error strings (such as quotes, slashes etc) 
otherwise writing to console fails. This will be fixed in the next 
release.

--
Rodney Tamblyn
44 Melville Street
Dunedin
New Zealand
+64 3 4778606
http://rodney.weblogs.com/



More information about the use-livecode mailing list