[Nitro] Trying to get cgi to work - am I on the right track?

Matthew Welland matt at kiatoa.com
Sun Feb 12 19:20:36 EST 2006


I need a kick start (or just a kick) with nitro and cgi. The examples run 
using:

ruby -rubygems run.rb

However I couldn't get cgi.rb to invoke run.rb from the hello example so I 
thought I'd try combining them to make an extremely simple starting point. I 
trimmed the example cgi.rb script from the blog example and added 
hello/run.rb to get the following:

==============cgi.rb==============
#!/home/kiatoaco/software/bin/ruby

ENV['NITRO_INVOKE'] = 'cgi_proc'
#$NITRO_NO_INVOKE = true

require 'rubygems'
require 'nitro'

require 'glue/logger'
Logger.set Logger.new('log/app.log')

class HelloWorld
  def index
    'Hello, World'
  end

  def math(val1, val2)
    "result = #{val1.to_i * 2}, another = #{val2 * 3}"
  end

end

require 'nitro/adapter/cgi'
Nitro.run(HelloWorld)
============end of cgi.rb============

I get:

============the apache log errors============
D, [2006-02-12T17:13:23.101834 #698] DEBUG -- : Using Memory 
sessions. /home/kiatoaco/software/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/adapter/cgi.rb:21: 
undefined method `thread_safe=' for Og:Module (NoMethodError) 
from /home/kiatoaco/software/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in 
`require__' 
from /home/kiatoaco/software/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in 
`require' from cgi.rb:23 [Sun Feb 12 17:13:23 2006] [error] [client 
130.13.218.203] Premature end of script 
headers: /home/kiatoaco/public_html/cgi-bin/cgi.rb




More information about the Nitro-general mailing list