Difference between revisions of "Server API"

From Fernseher
Jump to navigationJump to search
Line 1: Line 1:
The server object is a global object representing the server interfaces for logging and environment and such in my [[Modjs]] implementation.
Data members on the global server object:
Data members on the global server object:
*env: array of environment variables, including standard request headers and server information
*env: array of environment variables, including standard request headers and server information

Revision as of 16:45, 21 January 2009

The server object is a global object representing the server interfaces for logging and environment and such in my Modjs implementation.

Data members on the global server object:

  • env: array of environment variables, including standard request headers and server information

Functions on the global server object:

  • logNotice(string|array of strings): function to log a notice (or a list of notices) to the server error log
  • logError(string|array of strings): function to log an error (or a list of errors) to the server error log
  • runCmd(cmdstring): function execute a command on the server (with the httpd daemon's permissions!) execution of the script will wait until the cmd is finished, and will return the exit status of the command.
  • runCmd(cmd, array of args): same as above, but executes the given command with the arguments given in the array. arguments will be escaped or quoted as necessary
  • runCmd(File, array of args): same as above, but takes the given command from the File object passed in.