From: matz@... (Yukihiro Matsumoto) Date: 2001-09-18T23:30:33+09:00 Subject: [ruby-talk:21324] Re: Suggestions for new CGI lib Hi, In message "[ruby-talk:21315] Suggestions for new CGI lib" on 01/09/18, Anders Johannsen writes: |The goals of design are to: | |* Introduce the well-known 'Request/Response' model |* Separate Cookie, Post, Get and Environment namespaces |* Add support for 'plug-in' output handlers, thus making for example |gz compression of output easy. |* Use an open model to make integration with fastcgi/cgisock and |future technologies seamless |* Separate actual CGI and HTML generation, as they are two very |different matters (my suggestion only cover CGI) |-- while still maintaining 'ease-of-use' I think they are great. Here's some questions from me. |CGI::Request::Post # cgi.request.post |CGI::Request::Get # cgi.request.get |CGI::Request::Env # cgi.request.env |CGI::Request::Var # cgi.request.var I'm not sure what they are for. The current cgi.rb provides higher abstraction not to distinguish get/post/head. I think unified access method (for example cgi.request["user_var"]) is better. Perhaps cgi.request.var is for this purpose? What should these methods return? cgi.rb returns an array of values, but it's not convenient for many cases. |CGI::Request::Cookie # cgi.request.cookie Do we need cookie object? Probably we do. In that case, isn't it better to supply Cookie object to cgi.response.cookie? |CGI::Namespace # cgi.namespace | # Introduce new namespace with the indicated variables exported |(non-existant variables is nil) | cgi.namespace.var do | unless non_existant_var.nil? | # Do stuff | end | end I'm not sure what this method does. | # Set output options | cgi.output.handler = call_back | cgi.output.stream = $stdout I like this. |end # At the end of the block, cgi.print is automatically called Should it be cgi.output.flush instead of cgi.print? What do you think about HTML generation? Some want it separated from CGI. The current CGI::Session uses this integration. Finally, this next generation CGI library should coexist with the current cgi.rb. We have to choose library name carefully. matz.