|
||||||
How to Create and Run a REBOL CGI Web PageAn Introduction to Running REBOL/Core Scripts on the InternetA programmer can quickly create business rules by using REBOL/View, but by with a CGI application with REBOL/Core they can enable anyone with Internet access to run it.
Any programmer wanting (or needing) to start looking at business rules for an organisation can't go far wrong by starting with REBOL (see An Introduction to the REBOL Programming Language and How to Create a REBOL Dialect). In a very short time they will be able to build the business rules from any analysis that they have carried out by using REBOL/View. However, this does not really give give the developer a suitable way of delivering these business rules (or dialects) to a mass audience. For that they will need to turn to something like a CGI (Common Gateway Interface) web page. Fortunately that's exactly what REBOL (the Relative Expression-Based Object Language) can give them. Obtaining REBOLThere are a number of versions of REBOL available (both free and commercial) and the normal starting point is the free REBOL/View. The programmer may use this to create and run the REBOL dialects that can model an organisation' business rules and processes. However, for a CGI application the programmer will need the REBOL/Core version. This is still free but is designed for server use and has no GUI (Graphical User Interface). Once they've downloaded this to their web server then the programmer is ready to create their first REBOL CGI Page. Starting CGI ProgrammingOne of the pleasures of working with web servers such as Apache is that they really don't care which programming language a programmer uses. All they the web server is interested in is where to find the language's interpretor, and the programmer tells the web server about this by setting the shebang line. This is always the first line of the CGI script and in REBOL/Core's case the shebang line will look something like: #!C:\REBOL\rebcore -c
Here rebcore is being run in CGI mode (denoted by the use of the -c flag). It's worth noting at this point that the REBOL/Core executable can actually be placed in any directory on the web server and can be renamed (for example to "rebol"). Of course the programmer must update the shebang line appropriately. Only one other line is essential - the first output to the browser must be the HTML header definition: [REBOL]
print "content-type: text/html^/"
This could now be run as a CGI file, although it will only show a blank page. Therefore the programmer can add some HTML: print "<h1>Hello World</h1>"
If this code in now saved into a file in the web server cgi-bin directory then it can be run by anyone with Internet access to the server. Running a REBOL Script on the InternetAll that's require now for someone to run the REBOL script is a web browser and the address of the web server. For example if it is saved as "hello.r" then it could be accessed by the URL http://localhost/cgi-bin/hello.r, and the user would see the text displayed in their web browser (as seen in figure 1 at the bottom of this article). In this way a programmer can go on to create a set of business rules that can be accessed by anyone in their organisation, and the user need know nothing about REBOL at all. All they will need to know is how to use a web browser.
The copyright of the article How to Create and Run a REBOL CGI Web Page in Computer Programming Languages is owned by Mark Alexander Bain. Permission to republish How to Create and Run a REBOL CGI Web Page in print or online must be granted by the author in writing.
|
||||||
|
|
||||||
|
|
||||||