I tried posting this earlier, but it looks like it got lost

Wakou Aoyama <wakou / ruby-lang.org> wrote in message news:<20020521173005.GA8026%wakou / ruby-lang.org>...
> Hello,
> 
> I want to accept suggestion at any time. But, I want to make separate
> HTML generation library first. so, I want to wait for discussion of
> CGI interface a little.

I have a suggestion about how to separate CGI's functionality into
individual classes:

# each of these bits are independant of each other,
# so separate them into independant classes
request  = Request.new
response = Response.new
html     = HTML.new

# cgi delegates to these objects (using method_missing?)
cgi = CGI.new "html"
cgi.params['key'] = ['value']
cgi.out {
    cgi.html {
        ....
    }
}

# this also enables other idioms...
CGI.serve { |request, response|
    ....
}

# this bit is new functionality
# use keyword params for the sub objects....
request  = Request.new ( :params => test_params )
response = Response.new( :out    => mockio      )

request.params    == test_params    # <= true
response.outputer == mockio         # <= true

# and have cgi.new pass these params down, so this works too
cgi = CGI.new( :params => test_params, :out => mockio )
cgi.params   == test_params        # <= true
cgi.outputer == mockio             # <= true

I thought this would be a good immediate step towards improving the
organization of the cgi code.

~ Patrick