Web Techniques Magazine
May 1996 Volume 1, Issue 2 |
Writing CGI Scripts in REXX
Listing Ten /* CgiError # Prints out an error message which which containes appropriate headers, # markup, etcetera. # Parameters: # If no parameters, gives a generic error message # Otherwise, the first parameter will be the title and the rest will # be given as the body */ CgiError: PROCEDURE PARSE ARG Title, Body IF Title='' THEN Title='Error: script' MyURL() 'encountered fatal error.' SAY 'Content-type: text/html'; SAY '' SAY '<html><head><title>'Title'</title></head>' SAY '<body><h1>'Title'</h1>' IF Body/='' THEN SAY Body SAY '</body></html>' RETURN '' /* CgiDie Identical to CgiError, but also quits with the passed error message. */ CgiDie: PROCEDURE PARSE ARG Title, Body Fail=CgiError(Title, Body) EXIT /* MyURL Returns a URL to the script */ MyURL: PROCEDURE IF GETENV('SERVER_PORT')/='80' THEN Port=':'GETENV('SERVER_PORT') ELSE Port='' RETURN 'http://'GETENV('SERVER_NAME')||Port||GETENV('SCRIPT_NAME')
Copyright Web Techniques. All rights reserved.