On Thu, 06 Mar 2003 09:26:27 -0600, Frank Fejes wrote: > Personally, I don't quite like the CGI#out style of doing things so I set > the headers myself then output the html my own way. It's just as easy and > I feel like I'm in a bit more control. Here is a sample eruby program to > set a couple cookies: > > <% > require 'cgi' > > # get an expiration date string for a year from now > ed = CGI.rfc1123_date(Time.now + (60 * 60 * 24 * 365)) > > r = Apache.request > r.content_type = 'text/html' > r.headers_out.add('Set-Cookie', 'name=frank; path=/; expires=%s' % ed) > r.headers_out.add('Set-Cookie', 'language=eruby; path=/; expires=%s' % ed) > r.send_http_header > %> > > <html> > <body> > Here are the headers that came in: > <pre> > <% r.headers_in.each { |h| p h } %> > </pre> > Here are the headers we added and sent out: > <pre> > <% r.headers_out.each { |h| p h } %> > </pre> > </body> > </html> After I sent this out I thought I should clarify what I said for non mod_ruby plain old cgi execution. Of course you won't have the Apache request hanging around so you'll have to write your own headers. Replace the entire 'r' block with something like: ERuby.noheader = true puts "Set-Cookie: name=frank; path=/; expires=%s" % ed puts "Set-Cookie: language=eruby_cgi; path=/; expires=%s" % ed puts "Content-type: text/html\n\n" ERuby.noheader will tell eruby to not output headers on its own since we'll want to write them yourself. Later on in the script for the headers display you will need to replace that portion too since, again, the Apache object is not around in cgi land. Either way, the original message should be just fine since you wanted mod_ruby assistance in the first place. ;) --frank