From: Sam Date: 2009-03-07T13:50:06+09:00 Subject: Re: CGI newbie Brian Candler wrote: > David Masover wrote: >>> So pretty simple stuff like writing to text files and restarting >>> services. I only have 300mhz and 128mb of ram to work with so I don't >>> know if RoR would be the best idea? >> I would guess Rails would still work, but a better choice might be >> Sinatra, or even Merb if you want a full stack. I am also guessing that >> traditional CGI is still not the best choice. >> >> I'm going to say Sinatra and Ruby 1.9.1 are probably what you want. > > I second that. The HTML form processing is already included. Try this > for starters: > > require 'rubygems' > require 'sinatra' > > get '/' do > haml :index > end > > post '/update' do > STDERR.puts params.inspect # <= it's all in the params hash > # do some work > redirect '/' > end > > __END__ > @@ index > %h1 Hello > %p > OK, so it's a bit unfair of me to tell > a newbie to dive straight in with HAML. > But now I find this easier than form helpers. > %form{:action=>"/update",:method=>"post"} > %label > Type something here: > %input{:type=>"text",:name=>"foo"} > %label > Select one of these: > %select{:name=>"bar"} > %option One > %option Two > %option Three > %input{:type=>"submit",:value=>"go"} Interesting... Thanks! Sam