From: Tobias Reif Date: 2002-03-14T21:54:23+09:00 Subject: Re: Problems with Ruby, apache, and cgi Michele wrote: > However, when the client tries a more complicated script: > > #!/usr/local/bin/ruby > class Hello > attr_reader :msg > def initialize > @msg = "Hello, World" > end > end > > h = Hello.new > puts h.msg > print "Press RETURN" > $stdin.gets > > This fails. perhaps ----- #!/usr/local/bin/ruby class Hello attr_reader :msg def initialize @msg = "Hello, World" end end print "content-type: text/plain\n\n" h = Hello.new puts h.msg ----- since print "Press RETURN" $stdin.gets doesn't seem to make sense in a server browser program; and the browser wants to see some content header. For stuff that should run from the commandline as well as on the server, I do if ENV['CMDLINE'] # assign ARGV etc. else require 'cgi' cgi = CGI.new params = cgi.params # ... end Tobi -- * peace&love. * http://www.pinkjuice.com/