CALL
platformConfiguration parameters
-
warpscript.call.directory
The CALL
function invokes the external program whose path (relative to the warpscript.call.directory
directory) is on top of the stack. The calling convention will pass to the external
program the STRING object below the path on a line by itself on standard input after having URL encoded the STRING. The invoked
program is expected to return a URL encoded STRING object if invocation was successful, or a string starting with a space and followed by a URL encoded error message if an error was encoutered.
If you need to pass complex structures to the invoked program, you can use functions such as ->JSON
, ->PICKLE
and ->B64
to encode the input prior to the invocation.
Examples of callable programs are provided in shell and python.
The program must be stored in the directory described by the warpscript.call.directory
configuration parameter.
The program must first output on the stdout the number of concurrent thread allowed.
Example:
#!/bin/bash
echo 5 # 5 threads allowed
urldecode() {
# urldecode <string>
local url_encoded="${1//+/ }"
printf '%b' "${url_encoded//%/\\x}"
}
while true
do
read line
line=`urldecode "${line}"` # read the params given by the WarpScript
echo $line # Will be pushed on the stack
done