Difference between revisions of "Getting Started with Recital"

From Recital Documentation Wiki
Jump to: navigation, search
(Create a Hello World Script)
(Getting Started with Recital)
Line 8: Line 8:
 
  $ recital --help
 
  $ recital --help
 
  $ man recital
 
  $ man recital
 +
 +
To exit the Recital Workbench, type [[QUIT|quit]] at the prompt:
 +
 +
<pre>
 +
> quit
 +
</pre>
  
 
===Running Recital Scripts===
 
===Running Recital Scripts===
You can execute Recital scripts in one of two ways; from the command line (e.g. bash) or through a web server such as apache on Linux/UNIX or IIS on Windows. For the development of Recital applications that will be run from the command line, the Recital Workbench provides all the tools you will need to develop, debug, and test your applications.
+
You can execute Recital scripts or programs in one of two ways: from the command line (e.g. bash) or through a web server such as Apache on Linux/UNIX or IIS on Windows. For the development of Recital applications that will be run from the command line, the Recital Workbench provides all the tools you will need to develop, debug, and test your applications.
  
===Create a Hello World Script===
+
===Create a Hello World Program===
 
Recital uses the vi/vim editor on UNIX/Linux by default, although you can set an alternative editor using the [[SET TEDIT|set tedit]] command.  A simple text editor, called using the [[TEXTEDIT()|textedit()]] function is also provided.
 
Recital uses the vi/vim editor on UNIX/Linux by default, although you can set an alternative editor using the [[SET TEDIT|set tedit]] command.  A simple text editor, called using the [[TEXTEDIT()|textedit()]] function is also provided.
  
So, create a file called ''test.prg'' using your preferred editor and add the following line:
+
So, create a file called ''test.prg'' using your preferred editor and add the following lines:
  
 
<pre>
 
<pre>
 
? "Hello World"
 
? "Hello World"
 +
?
 
</pre>
 
</pre>
  
Save the file and run the [[DO|do]] command from the Recital prompt:
+
Save the file.
 +
 
 +
===Running the Hello World Program===
 +
You can run the program using the [[DO|do]] command from the Recital Workbench prompt:
  
 
<pre>
 
<pre>
do test
+
> do test
 
</pre>
 
</pre>
  
===Running the Hello World Script===
+
Or using ''recital'' from the shell prompt:
 +
 
 +
<pre>
 +
$ recital test
 +
</pre>
 +
 
 +
You will notice that when you run the script from the shell prompt, the text display flashes on the screen.  To have time to read the text, Recital needs to go into a read or wait state.  Modify your ''test.prg'' file as follows:
 +
 
 +
<pre>
 +
? "Hello World"
 +
wait
 +
</pre>
 +
 
 +
Save the file, then run it again from the shell prompt:
 +
 
 +
<pre>
 +
$ recital test
 +
</pre>
 +
 
 +
This time, after displaying ''Hello World'', Recital will prompt you to press a key before continuing.
 +
 
 
===Integrating our Recital Hello World Script with bash===
 
===Integrating our Recital Hello World Script with bash===
 
===Deploying our Recital Hello World Script on the Web===
 
===Deploying our Recital Hello World Script on the Web===
 
===Summary===
 
===Summary===

Revision as of 10:53, 23 July 2010

Getting Started with Recital

Starting the Recital Workbench

One of the most useful tools for writing Recital code is the Recital Workbench, a character mode interactive editing, debugging and execution environment in which commands are run as you type them and press Return.

You run recital by typing "recital" at a shell prompt. Linux also has a man page that describes how to use the recital command.

$ recital
$ recital --help
$ man recital

To exit the Recital Workbench, type quit at the prompt:

> quit

Running Recital Scripts

You can execute Recital scripts or programs in one of two ways: from the command line (e.g. bash) or through a web server such as Apache on Linux/UNIX or IIS on Windows. For the development of Recital applications that will be run from the command line, the Recital Workbench provides all the tools you will need to develop, debug, and test your applications.

Create a Hello World Program

Recital uses the vi/vim editor on UNIX/Linux by default, although you can set an alternative editor using the set tedit command. A simple text editor, called using the textedit() function is also provided.

So, create a file called test.prg using your preferred editor and add the following lines:

? "Hello World"
?

Save the file.

Running the Hello World Program

You can run the program using the do command from the Recital Workbench prompt:

> do test

Or using recital from the shell prompt:

$ recital test

You will notice that when you run the script from the shell prompt, the text display flashes on the screen. To have time to read the text, Recital needs to go into a read or wait state. Modify your test.prg file as follows:

? "Hello World"
wait

Save the file, then run it again from the shell prompt:

$ recital test

This time, after displaying Hello World, Recital will prompt you to press a key before continuing.

Integrating our Recital Hello World Script with bash

Deploying our Recital Hello World Script on the Web

Summary