On Fri, Apr 04, 2003 at 11:39:55PM +0900, Robert Klemme wrote: > Currently I can't see why you want to inherit a main function - if it's > what I guess, then main is very application specific and does not lend > itself easily for inheritance at all. Perhaps not, but you probably wanted to inherit all the scaffolding around it. For example, here is a simple but useful CGI application framework: require 'fcgi' class GUI def initialize(cgi) @cgi = cgi @done_header = false end def header(*args) return if @done_header puts @cgi.header(*args) @done_header = true end # def main: virtual def self.run FCGI.each_cgi do |cgi| begin app = self.new(cgi) app.main rescue Exception => detail app ? app.header : (puts cgi.header) print <<EOS <html> <head><title>Internal error in #{$0}</title></head> <body> <h1>Internal error in #{$0}</h1> <b>#{CGI.escapeHTML(detail.message.to_s)}</b> EOS puts "<pre>#{CGI.escapeHTML(detail.backtrace.join(\"\n\"))}</pre>" if detail.backtrace puts "</body></html>" end end end end You then create your application like this: class MyGUI < GUI def main header name = @cgi['name'][0] if name puts "Hello #{name}" else puts "Who are you?" end end end MyGUI.run That saves you a lot of work :-) The superclass 'GUI' could have lots of other helper functions in it which you also might want to inherit. Regards, Brian.