[#1094] Re: [ruby-cvs] ruby, ruby/lib: * eval.c (ev_const_defined, ev_const_get), variable.c — Dave Thomas <dave@...>

> * eval.c (rb_mod_autoload, rb_mod_autoload_p): new method;

12 messages 2003/05/29
[#1095] Re: [ruby-cvs] ruby, ruby/lib: * eval.c (ev_const_defined, ev_const_get), variable.c — nobu.nokada@... 2003/05/29

Hi,

CGI issue (was: CGI::Session generating blank IDs?)

From: Ryan Pavlik <rpav@...>
Date: 2003-05-02 06:59:03 UTC
List: ruby-core #1001
On Fri, 2 May 2003 14:42:58 +0900
Ryan Pavlik <rpav@nwlink.com> wrote:

> Hmm, for some reason the latest CVS's CGI::Session seems to be
> generating blank 'id' strings, although the code looks fine.
<snip>

Of course, not long after posting I figure this out.  Figures.
The trick is that CGI::Session needs {'new_session' => true} to
create a new session.

It would be nice if this were documented someplace, like the
ChangeLog. ;-)

Also there appears to be a change in CGI, in that CGI#[] now
returns a "Value" class, which is a String subclass overriding
:[] and :first.

I would like to say: This Is Dumb.  I understand the need to
include deprecation code, but there should at _least_ be a
switch someplace to disable it (preferably returning a regular
String).  Getting values that are of undocumented classes that
redefine regular methods to do uncharacteristic things causes
more problems than it solves.  I recommend something like this:


class Value < String
    if $CGI_DEPRECATION
        def [] (key)
            $stderr.print "...warning..."
            super
        end

        def first
            ...
        end
    end
end

At _least_ this behaves like a String, and you can disable it if
you acknowledge the fact you know about the changes.

-- 
Ryan Pavlik <rpav@users.sf.net>

"Green werewolves are a perfectly natural part of... uh
 nature. As are ghosts." - 8BT

In This Thread