Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Status

This project is not in active development. At this point (Feb 2008), it shouldn't be too difficult to get it working with recent DMD releases.

Downloads

wombat_0.48.tgz

Quick Start

Wombat is a library for using CGI ( tested with Apache 1 & 2 ) for web applications.

Wombat works in pairs, there is a D file that contains all your business logic, and an HTML file that has embedded code for presentation logic. Here is an example

Every Wombat application must call dgi_begin() ( all headers must be sent before this is called ) , and dgi_end (). And if you have a corresponding HTML file, you must import the file and [tem]plate the file, for example:

const char [] html = import("get.html");
const char [] code = plateFile(html);

This is all that is required to for your Wombat apps!

Here is a list of global variables available to you at runtime for your web app.

char [] [ char [] ] cookies; // if ( "myCookie" in cookies ) print(cookies["myCookie"]);
char [] [ char [] ] get; // get["myVar"];
char [] [ char [] ] post; // post[myVar"];
char [] [ char [] ] session; // session["mySessionVar"];
char [] [ char [] ] [ char [] ] files; // print(files["myFile"]["size"]);
                                       // print(files["myFile"]["client_file_name"]);
                                       // print(files["myFile"]["server_file_name"]);

And here is a quick function reference

void header( char [] text ); // send out standard headers
void redirect( char [] url ) ; // redirect user to said url

bool fileWrite( char [] path, char [] content, bool append = false ); // write to a file
char [] fileRead( char [] path ); // slurps in a file
void fileMove( char [] source, char [] destination ); // move a file 

char [] urlEncode ( char [] url ); // encode a url
char [] urlDecode ( char [] url ); // dencode a url

Examples

Coming up Next

  • ORM mapper, that generates SQL for committing - retrieving and creating D beans based on in file comments
  • Plates for Mango's servlets