なひです.

> From: wakou / fsinet.or.jp [mailto:wakou / fsinet.or.jp]
> Sent: Wednesday, September 01, 1999 4:32 PM

> > '[0]'が確かにちょっと気持ち悪いですが、それは仕方がないでしょう。
> 
> そう言って頂けると嬉しいです。python 方式になるほどと思いつつも、複数
> のデータが返って来る場合には、データの数ではなく、型によって判定すると
> いうちょっと気持良くない事になるのが引っかかっていました。

なひも
http://www.jin.gr.jp/~nahi/kb/idef/
で使わせて頂いているのですが,[0]のままでいいんじゃないかと思ってます.
http://www.jin.gr.jp/~nahi/kb/idef/index.cgi?c=1&c=2&c=3
なんていうGETリクエストもあり得るし.^^;(有用かどうかは別ですが...)

> やはり本筋としては、cgi.has_key?("name1") などであらかじめチェックして
> おくか、例外処理が手軽な事を利用して、rescue の方がいいような気がして
> います。

なひはhas_key?でチェックしました.
具体的に,件のCGIの中での使い方はこんな感じです.

# 「require 'application'」のapplicationは,
# http://www.jin.gr.jp/~nahi/Ruby/ruby.shtml#application
# のものです.

これを書いた時は,
「c=???が複数あったら最初のやつ」というつもりで[0]と書いてました.
has_key?と共に,特に違和感は感じませんでしたです.

# SYNOPSIS
#   CGIApp.new( appName )
#
# ARGS
#   appName	Name String of the CGI application.
#
# DESCRIPTION
#   Running this application object as a CGI with 'c=[value]' causes
#   executing the method 'exec_proc_[value]( query )'.
#     ie. 'c=entry' -> exec_proc_entry( query )
#   Without 'c=[value]' in query, 'exec_proc_default( query )' are called.
#
#   'query' is a Hash of query except the key 'c'.
#
require 'application'
require 'CGI'
class CGIApp < Application
  include Log::Severity

  private
  def initialize( appName )
    super( appName )
    @query = CGI.new()
  end

  def run()
    log( SEV_INFO, 'Accessed: ' << (( @query.remote_user != "" )?
      @query.remote_user : 'anonymous' ) << '@' <<
      (( @query.remote_host != "" )? @query.remote_host : @query.remote_addr ))
    if ( @query.has_key?( 'c' ))
      method = ( 'exec_proc_' << @query['c'][0] ).intern
      @query.delete( 'c' )
      send( method, @query )
    else
      exec_proc_default( @query )
    end
    # CAUTION: Result code must be here.
  end
end