From: Kent Dahl Date: 2004-06-12T18:43:39+09:00 Subject: Re: cgi maintaining state information Cere Davis wrote: > Actually, I am working on this but but I am new to this and am trying > figuring out how to override a function in the cgi library at the > moment.... > > > I have a thing like: > > class CGI > > def checkbox((name = "", value = nil, checked = nil) > > ....stuff in place of the default behavior of cgi.rb checkbox > > end > end > > But my code doesn't seem to recognize this overriden function. Does > anyone know how I can override functions like this? If this is in a script run by mod_ruby or eruby, then it may be that you are actually creating a different CGI class in a anonymous module. On the other hand, if its run like a regular CGI script, I don't think this should be a problem. Have you tried inheriting from the CGI class instead? class MyCGI < CGI def checkbox # etc end end Another option is to put your method definitions in a module and extending your actual CGI object dynamically... module MyCGIExt def checkbox # etc end end cgi = CGI.new cgi.extend MyCGIExt These last two should work properly in a mod_ruby/eruby environment, AFAIK. HTH. -- (\[ Kent Dahl ]/)_ _~_ _____[ http://www.pvv.org/~kentda/ ]_____/~ ))\_student_/(( \__d L b__/ Master of Science in Technology ) ( \__\_�|�_/__/ ) _) Industrial economics and technology management ( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)