Perl utilities have been created to aid in adapting existing programs to communicate in this format. A Perl script is written as a wrapper around the existing program, using the Perl command
require server_util.pl;to enable access to the routines.
The Perl variables take their names from the server specification file. The actual variable string ``name'' is used for parameter names, and ``name(type)'' for input and output variable names. Only parameters and variables in the specification file may be used.
Read the named specification file to initialize variables. read_spec must be the first utility routine called, and may be called only once.read_input()
Read server input from stdin and set input variables and parameters accordingly. read_input is called immediately after read_spec, and may be called only once.check_parameter(param_name)
Check if a parameter has been set by the call to read_input. This is used because get_parameter will exit if a target parameter has not been set.get_parameter(param_name)
Return the value of an input parameter (set by read_input). get_parameter will terminate the program if the named parameter has not been set, so check_parameter should be used to test optional parameters.check_input(input_name)
Check if an input variable has been set by the call to read_input. This is used because get_input will exit if a target input variable has not been set.get_input(input_name)
Return the value of an input variable (set by read_input). get_input will terminate the program if the named variable has not been set, so check_input should be used to test optional variables.put_output(output_name, value)
Assign a value to an output variable. Each output variable may be assigned only once. Output variables are not written to stdout until write_output is called.write_output()
This causes all assigned output variables to be written to stdout. It must be the very last utility routine called and may be called only once.
The wrapper manages these resources, and communicates using the server input/output language.