On 2002.07.15, Patrick May <patrick-may / monmouth.com> wrote:
> Would something like this work:
> 
> print "Content-type: text/html\r\n"
> print "\r\n"
> print "<pre>"
> 
> .... run tests, do output here ...
> 
> print "</pre>"

This is what the initial version of mine did.  Of course, <pre> isn't
enough -- you really want <xmp> because the expected and actual strings
are guarded with "< ... >" and therefore those < and > need to be
HTML escaped as &lt; and &gt; ... unless you use <xmp> ...

Now, where my code is at ... can pretty much handle everything the
right way, IMHO.  ;-)

> I don't think it's simple to autodetect whether a script is running
> within a cgi enviroment.  Look at the code for the QueryExtension
> module within cgi for the enviroment checking code.

I test for ENV['GATEWAY_INTERFACE'].nil? which is Good Enough for me.

-- Dossy

-- 
Dossy Shiobara                       mail: dossy / panoptic.com 
Panoptic Computer Network             web: http://www.panoptic.com/ 
  "He realized the fastest way to change is to laugh at your own
    folly -- then you can let go and quickly move on." (p. 70)