Redirecting Caravan output.
==========================
Intro:
Caravan script is used to output dynamic data to the browser. This is done
by invoking the object property that has to be displayed. The syntax of this
is:
"This is dynamic data :";objectname(propertyname);"
" // emits the value to output stream
As you can see constant strings are also output in the above code. This
gives great flexibilty in formating the output.
The output stream is most of the time the tcpip connection to the browser.
The objective of this document is to explain the ways this output can be
redirected. Caravan has an "output" statement which can be used to control
the output stream.
OUTPUT statement:
================
The syntax of output statement:
output ;
append ;// appends to existing file
outputstream can be one of the following;
1. a quoted string denoting a file
example
output "con";// data is now going to the console
output "lpt1"
output "c:\caravan\doc\mylog.txt"
2. a variable name
var tmp
tmp(log)="c:\mylogs\log.txt"
output tmp(log)
3. objectname of a file object (ver 3.01)
file myfile="test.txt";// this file is in memory only since no path is given
output myfile;
mode url;// urlencodes next output -- see description of mode command
"1234567890";//
close output
myfile(file);// displays the urlencoded string
All of the above has the effect of redirecting the dynamic data from the
standard output to an alternate stream. The standard output is always
the browser if the script was invoked by a request from the browser.
When not invoked by the browser (scheduler, eventhandler, ftphandler etc.)
the standard output is the console.
The output redirecting facility can be used to create logs or reports,
debugging(1) and generating complex strings which can be subsequently
reused in the program (3).
Closing output:
The syntax for closing the current outputstream is:
close output;// reverts to original output stream
=====================================end====================================