From: Dossy Date: 2002-07-15T20:10:22+09:00 Subject: Re: Has anyone combined Test::Unit with CGI? On 2002.07.15, Patrick May wrote: > Would something like this work: > > print "Content-type: text/html\r\n" > print "\r\n" > print "
"
> 
> .... run tests, do output here ...
> 
> print "
" This is what the initial version of mine did. Of course,
 isn't
enough -- you really want  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)