On 2002.05.13, David Alan Black <dblack / candle.superlink.net> wrote:
> I'm in "about-to-drive-50-minutes-in-the-rain-to-graduation" mode,
> which is probably only marginally better :-)

Heh.  I just realized that you're at SHU -- another New Jerseyean!
I'm not the only one ... !  Of course, I'm at the Northern end ...

> I guess a lot of what we've been talking about comes down to the
> question of whether there really is a CGI idiom -- that is, whether
> it's more natural, intuitive, etc., for the simplest expression in a
> programming language to correspond to this or that aspect of CGI
> behavior.  In a sense, a single-value CGI param is just a special case
> of a multi-value one (since any param, I think, *can* be multi-value,
> given the right query string).  So then the question is: what's a
> special case of a multi-value array in Ruby?  A one-value array, or a
> string?

Here's what I'm thinking ... (If I keep this up, I may just go and
_implement_ my own CGI class to demonstrate ...)

Here's the CGI params:

  foo=bar&quux=one&quux=two&quux=three

Assume the necessary classes have been defined.  Here are my
test cases:

  cgi = CGI.new

  cgi.type              # => CGI

  cgi['foo']            # => "bar"
  cgi['foo'].to_s       # => "bar"
  cgi['foo'].type       # => CGI::Param
  cgi['foo'].to_a       # => ["foo"]

  cgi['quux']           # => "bar"
  cgi['quux'].to_s      # => "bar"
  cgi['quux'].type      # => CGI::Param
  cgi['quux'].to_a      # => ["one", "two", "three"]

Does this make sense?  I think it ought to be trivial to
implement -- as in, I could probably some up with something
usable inside a day.

-- Dossy 

-- 
Dossy Shiobara                       mail: dossy / panoptic.com 
Panoptic Computer Network             web: http://www.panoptic.com/ 
  "He realized the fastest way to change is to laugh at your own
    folly -- then you can let go and quickly move on." (p. 70)