On Wed, Jul 10, 2002 at 11:03:09AM -0700, Ned Konz wrote:
> Well, then, you could do this:
> 
> class MyClass
>   def method_missing(sym, *args)
>     if $cgi.has_key?(sym) && args.size < 2
>       return $cgi[sym.to_s][ args[0] || 0 ]
>     end
>     super
>   end
> end

Interesting. So then, all the variables would automatically be
declared if the web browser passed that variable, just like in PHP.

I think I'll stick with an explicit $cgi.export(self, %w(phone name
email)) though; I'm not quite comfortable with the idea of the web
browser being able to cause any variable to be set in my program. That
can make it easy to code security flaws.

Anyone coming from PHP would like this trick, though!