Examples

Nick Willson <[email protected]> Mon, 11 Oct 2004 00:48:10 -0700
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
Please help me find working examples of using mod_ruby and its classes.

I attempted to use the following example from
http://modruby.net/en/doc/?cmd=view&p=Apache%3A%3ARequest&key=example

include Apache

# Make sure that ExecCGI and Indexes are turned on for the Location
# being served:
unless req.allow_options & (OPT_EXECCGI|OPT_INDEXES)
    req.log_reason( "ExecCGI and/or Indexes are off in this directory",
                    req.filename )
    return FORBIDDEN
end

which produces the following in the apache error.log

[Mon Oct 11 00:38:54 2004] [error] mod_ruby: error in ruby
[Mon Oct 11 00:38:54 2004] [error] mod_ruby: /var/www/ruby/test.rb:5:
undefined local variable or method `req' for main:Object (NameError)
[Mon Oct 11 00:38:54 2004] [error] mod_ruby:   from
/usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Mon Oct 11 00:38:54 2004] [error] mod_ruby:   from
/usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

-- 
Nick