In addition to the different formats, where the data are
located is different for GET and POST forms.
For action = GET, the data are given in an environment
variable named QUERY_STRING.
For action = POST, they are available from standard
input.
CGIwithR hides these details and just presents
formData.
Difficult since not running interactively.
Get the script running within a regular R session,
e.g. as a call to a function first
Print diagnostic information to standard output so it
goes into the resulting document.
Or cat(“some message”, file = stderr()) which sends it to
the Web server’s log file.
Run
tail -f logs/error_log
in a separate window when submitting the request.
[Mon Nov 28 06:02:02 2005] [error] [client 127.0.0.1] Error in cat(list(...), file, sep,
fill, labels, append) : , referer: http://localhost:9764/s141group1/htdocs/
bootstrapFile.html
[Mon Nov 28 06:02:02 2005] [error] [client 127.0.0.1] \targument 3 not yet handled by
cat, referer: http://localhost:9764/s141group1/htdocs/bootstrapFile.html
[Mon Nov 28 06:02:02 2005] [error] [client 127.0.0.1] Execution halted, referer: http://
localhost:9764/s141group1/htdocs/bootstrapFile.html
[Mon Nov 28 06:02:03 2005] [error] [client 127.0.0.1] File does not exist: /Users/
s141http/httpd/htdocs/favicon.ico
[Mon Nov 28 06:03:08 2005] [error] [client 127.0.0.1] Error: object "verbose" not found,
referer: http://localhost:9764/s141group1/htdocs/bootstrapFile.html
[Mon Nov 28 06:03:08 2005] [error] [client 127.0.0.1] Execution halted, referer: http://
localhost:9764/s141group1/htdocs/bootstrapFile.html
[Mon Nov 28 06:03:08 2005] [error] [client 127.0.0.1] File does not exist: /Users/
s141http/httpd/htdocs/favicon.ico
[Mon Nov 28 06:16:13 2005] [error] [client 127.0.0.1] File does not exist: /Users/
s141http/httpd/htdocs/favicon.ico
[Mon Nov 28 06:16:43 2005] [error] [client 127.0.0.1] File does not exist: /Users/
s141http/httpd/htdocs/favicon.ico
[Mon Nov 28 06:19:03 2005] [error] [client 127.0.0.1] Error: object "verbose" not found,
referer: http://localhost:9764/s141group1/htdocs/bootstrapFile.html
[Mon Nov 28 06:19:04 2005] [error] [client 127.0.0.1] File does not exist: /Users/
s141http/httpd/htdocs/favicon.ico
Post-mortem debugging via dump.frames() and debugger
() functions.
In the script, arrange to have the state dumped when
there is an error
options(error = quote({dump.frames("/tmp/group1/
last.dump", to.file = TRUE); q()}))
If there is an error, load the rda file and debug:
load(“/tmp/group1/last.dump.rda”)
debugger(get(“/tmp/group1/last.dump.rda”)
May give more information.