[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
|1Run-Time Environments|

|^ A Run-Time Environment (RTE) is a persistant scripting environment with
similar objectives to CGIplus |...| reducing script response time, increasing
server throughput and reducing system impact.  In fact the RTE environment is
implemented using CGIplus!  There is very little difference in the behaviour of
CGIplus scripts and RTEs.  Both are activated by the server, process multiple
requests (reading the request CGI environment from a data stream supplied by
the server), persist between requests in a quiescent state, and may be removed
by the server if idle for a specified period or when it wishes to use the
process for some other purpose. |*Like CGIplus an RTE must be purpose-written
for the environment!|  What is the difference then?

|^ With CGIplus the script itself persists between uses, retaining all of its
state.  With an RTE the script does not persist or retain state, only the RTE
itself.

|^ A RTE is intended as an environment in which a script source is interpreted
or otherwise processed, that is for scripting engines, although it is not
limited to that.  The essential  difference between an RTE and a CGIplus script
is this script source.  In CGIplus the SCRIPT_NAME and SCRIPT_FILENAME CGI
variables reflect the script itself, and remain constant for each activation of
the script, with PATH_INFO and PATH_TRANSLATED providing the additional
"location" information for the script processing.  With an RTE the SCRIPT_NAME
and SCRIPT_FILENAME can vary with each activation.  This allows the RTE to
process multiple, successive different (or the same) scripts, each with its own
PATH_INFO and PATH_TRANSLATED.  Hence, it is not unreasonable to consider the
two environments to be the same, with a slight difference in the mapping of
resources passed to them.

|^ This might be best illustrated with examples.

|0CGIplus Example|

|^ Consider the mapping rule

|code|
exec+ /cgiplus-bin/* /cgi-bin/*
|!code|
 applied to the following CGIplus request

|code|
/cgiplus-bin/xyz/the/path/information?and=a&query=string
|!code|

|^ If the script was an executable it would be activated as

|code|
CGI-BIN:[000000]XYZ.EXE
|!code|

with script CGI information

|code|
/cgiplus-bin/xyz
CGI-BIN:[000000]XYZ.EXE
|!code|

and the request path information and query string supplied as

|code|
/the/path/information
THE:[PATH]INFORMATION
and=a&query=string
|!code|

|0RTE Example|

|^ By contrast with a request to activate an RTE the following mapping rule

|code|
exec+ /xyz-bin/* (CGI-BIN:[000000]XYZ.EXE)/wasd_root/src/xyz/*
|!code|

(note the RTE executable specified inside parentheses) and request

|code|
/xyz-bin/an_example/the/path/information?and=a&query=string
|!code|

would activate the scripting environment (perhaps interpreter)

|code|
CGI-BIN:[000000]XYZ.EXE
|!code|

supplying it with per-request script name and file information 

|code|
/xyz-bin/an_example.xyz
WASD_ROOT:[SRC.XYZ]AN_EXAMPLE.XYZ
|!code|

and path and query string information

|code|
/the/path/information
THE:[PATH]INFORMATION
and=a&query=string
|!code|

|0Summary|

|^ As can be seen the script information is constant for each request to a
CGIplus script, while with RTE the script information could vary with each
request (although of course it would be the same if the same script is
requested).  In the case of CGIplus the |/process what?| request information is
provided only by path information, however with RTE both script and path
information are used.

|2RTE Programming|

|^ |*The RTE interface is still CGI||, with all the usual environment variables
and input/output streams available, just in a CGIplus environment!  Hence when
coding a Run-Time Environment the same considerations involved in CGIplus
programming apply (|link|CGIplus||).

|^ In particular it is important a RTE should explicitly close files, free
allocated memory, etc., after processing a request (of course it cannot rely on
image  run-down to clean-up after itself). It is particularly important that
all traces of each script's processing are removed after it concludes.  This
does not mean for example that databases need to be completely closed, etc.,
which might defeat the purpose of using a persistant environment, just that
great care must be exercised by the programmer to prevent one script
interfering with another!

|^ An example RTE,
|link%=|/wasd_root/src/CGIplus/RTE_example.c|\
WASD_ROOT:[SRC.CGIPLUS]RTE_EXAMPLE.C|
provides the basics of the environment.

|^ A source code collection of C language functions useful for processing the
more vexing aspects of CGI/CGIplus/RTE programming (|\|link|CGI Function
Library||).  The example RTE implementation uses this library.

|2Server Configuration|

|^ The following configuration information uses the supplied Perl RTE as the
example.  Note that RTE scripting engines must always be mapped using the EXEC+
rules.  The SCRIPT+ rule does not apply.

|^ The following rule in WASD_CONFIG_MAP maps the /pl-bin/ location to where the
site wishes to locate its CGI Perl scripts (not necessarily the same as in the
example).

|code|
exec+ /pl-bin/* (CGI-BIN:[000000]PERLRTE.EXE)/wasd_root/src/perl/*
|!code|

|^ With this rule Perl scripts may be accessed using 

|code|
http://host.name.domain/pl-bin/an_example
|!code|

|^ This WASD_CONFIG_GLOBAL rule ensures Perl scripts could be activated via
the Perl RTE even if the WASD_CONFIG_MAP rule did not exist (|link|Script
Run-Time||).

|code|
[DclScriptRunTime]
.PL  (CGI-BIN:[000000]PERLRTE.EXE)
|!code|

|note|
The server makes no check of the RTE executable (or procedure) before
attempting to activate  it using DCL for processing the script.  If it does not
exist or is not accessible due to incorrent file protections the DCL of the
scripting process will report the problem.
|!note|

|^ It does by default however, check that the file used as the script source
exists as with other scripting environments.  If it does not this is reported
as a "script not found".  For RTEs that wish to report on this themselves, or
that possibly construct their own script specification via some internal
processing, this server behaviour may be suppressed for the script activation
path using the WASD_CONFIG_MAP path SETting "script=nofind" as in the following
example.

|code|
set /xyz-bin/* script=nofind
exec+ /xyz-bin/* (CGI-BIN:[000000]XYZ.EXE)/wasd_root/src/xyz/*
|!code|

|^ CGI environment variables SCRIPT_FILENAME and PATH_TRANSLATED can be
provided to any RTE script in Unix file-system syntax should that script
require or prefer it using this format.  See |link|Unix Syntax||.

|0DCL procedure|

|^ If the RTE executable requires |/wrapping| in a DCL procedure (perhaps to
provide some command-line specific parameter or define a C-RTL logical name)
this can be specified in place of an executable.  Merely prefix the
specification with a "@".  The default is to run an executable (this can
explicitly be specified using a leading "$") while the leading "@" provides a
DCL procedure activation.