On Fri, Aug 08, 2003 at 09:08:50PM +0900, Dmitry Borodaenko wrote:
> I thought it would be trivial to derive a class from CGI and add some
> instance variables to it, however:
> 
> require 'cgi'
> class SamizdatCGI < CGI
>     def initialize
>         super
> 	@session = Session.new(self)
>     end
>     attr_reader :session
> end
> cgi = SamizdatCGI.new
> 
> As soon as I pass some parameters into such script, I get the following
> error:
> 
> /usr/lib/ruby/1.6/cgi.rb:1595:in `class_eval': (eval):1:in
> `remove_const': constant SamizdatCGI::CGI_PARAMS not defined (NameError)
>         from /usr/lib/ruby/1.6/cgi.rb:1595:in `class_eval'
>         from /usr/lib/ruby/1.6/cgi.rb:1595:in `initialize'
>         from /usr/lib/ruby/1.6/cgi.rb:1593

Yeah, it's a bit wierd and inconvenient, and an unnecessary use of constants
IMO. It could certainly be made more flexible.

You can work around it; download ruby-fcgi-0.8.3 from RAA to see how it's
done.

Regards,

Brian.