From: Eliezer Croitoru Date: 2012-11-29T14:00:47+09:00 Subject: Re: CGI question Hey Assaf, In a real server case it would send parameters to the script. In a command line case once the cgi code scope ended it will require the parameters entered one by one and CTRL+D should run it. I am using ruby for CGI scripts but formatting a form this way can be very painful. I would go for writing the RAW html by myself with touches of variables if needed. Regards, Eliezer On 11/28/2012 12:58 PM, Assaf Shomer wrote: > Ruby Beginner question. > > In the "Ruby and the Web" section of the pickaxe book they talk about > CGI and give the following example: > > ======== > require 'cgi' > cgi = CGI.new("html3") # add HTML generation methods > cgi.out do > cgi.html do > cgi.head { "\n"+cgi.title { "This Is a Test"} } + > cgi.body do "\n"+ > cgi.form do"\n"+ > cgi.hr + > cgi.h1 { "A Form: " } + "\n"+ > cgi.textarea("get_text") +"\n"+ > cgi.br + > cgi.submit > end > end > end > end > ============= > > They claim that this program produces: > ============== > Content-Type: text/html > Content-Length: 302 > > This Is a Test >
>

A Form:

> >
> ====== > > When i run this program i get nothing on the console output, and when i > tried to run it in irb, it got stuck on the cgi = CGI.new("html3") line > (by stuck I mean further ENTERs don't give me the standard > irb(main):007:0> ) and gave the following message: > ============== > (offline mode: enter name=value pairs on standard input) > ============== > can anyone explain to me what's going on? > > Thanks. > > Assaf. > -- Eliezer Croitoru https://www1.ngtech.co.il sip:ngtech@sip2sip.info IT consulting for Nonprofit organizations eliezer ngtech.co.il