EasyCGI
EasyCGI is a collection of very small libraries for specific needs of web developers. They are more or less independent from each other allowing you to mix and match your own libraries with them. Each library is there to solve one core task of web app development, it does that in the most easy and quick way.
Derivative works from this libraries are currently being used on real world environment with heavy load.
The libraries are:
• EasyCGI
• EasySessions
• EasySendmail
• EasyRPC
• EasyDebug
EasyCGI - Core Text CGI Library
This library provides core functions for text cgis. It parses both GET and POST parameters picking the variables and inserting them into a global array variable. It also provides a cookie array. Just by "start using" the library it will read STDIN and assemble all the useful data into the gDataA array. You can then just fiddle with this variable. It has a function for sending response to the browser with custom content types and a function for assembling apache style server side includes.
Example:
cgiOutput "Hello World!", "text/plain"
EasySessions - Quick And Dirty session management
Keeping track of sessions is not as easy as the average user thinks. The easysessions library has functions for saving a session array for future use. With this library you can easily maintain state between multiple cgis and multiple requests, a need for most web apps.Example #1: Saving a session
...
put "andre" into tArrayA["first name"]
put "garzia" into tArrayA["last name"]
put "Newtons" into tArrayA["favorite dead technology"]
put sessionStore(tArrayA) into tUniqueID
...
This unique id is passed on to the next cgi in a hidden form or a url param.
Example #2: Restoring a session
...
put sessionRestore(tUniqueID) into tArrayA
cgiOutput ("Hello" && tArrayA["first name"] && tArrayA["last name"]), "text/plain"
...
EasySendmail - Fast and Easy email sending
Most web apps are not confined only to the web. eBay and PayPal sends email notifications for everything. Most web fora uses some kind of email authentication before you're allowed to be an active member. Email sending is an integral part of any web development suite of tools.
We have some really nice libraries for email sending in transcript but they are not suited for cgi. Most cgis are not allowed to open tcp/ip connections and sending email would take time too. The EasySendmail library uses the omnipresent sendmail tool to send your emails. If you need to send attachments or html mail you can combine it with Shao Sean libMessage.
EasyRPC - Minimalist XML-RPC server library
In the new web 2.0 world, web services are again growing in importance. XML-RPC is a simple and easy spec and only a subset of it is implemented here. This library allow you to serve your stack and methods to some remote application. It treats all values as strings and theres no support for dicts and arrays, but that is a non-issue since Rev does not support nested arrays or dicts anyway.
Example #1: Serving
Suppose you have a stack with couple math methods you want to serve.
...
start using "EasyRPC.rev"
rpcAddHandler("math.add", "myAdd")
rpcAddHandler("math.div", "myDiv)
rpcAddHandler("math.mult", "myMult")
rpcAddHandler("math.sub", "mySub")
rpcProcessRequest
...
In this little example you serve your handlers myAdd, myDiv, myMult and mySub. Its a common practive to use a suite to group the methods, in here we're serving the handlers like they were methods on a math object. So any XML-RPC client would be able to call myAdd by calling math.add on the server.
EasyDebug - saving time and debuging web apps easily.
EasyDebug is a very easy to use library that will display a simple HTML report if a error happens in your CGI. The report is very rich and will surelly help you understand what is going wrong. Check the EasyDebug page for more info.