[REBOL] Re: works for GET, not POST
From: rebol:techscribe at: 31-Jan-2001 10:36
Hi GS Jones,
I didn't read your message as containing anything negative.
In the version I'm using on the Website I use the make object! in the
calling function instead of in the retrieve-user-data function. That's
incidental.
The reason for make object! is:
decode-cgi returns a block that contains set-word! value pairs:
[name: "some-name" phone: "some-phone"]
To conveniently retrieve the values by using a path notation,
result/name result/phone I use the block returned by decode-cgi to
construct an object:
result: make object! decode-cgi input
If I were to simply say
result: decode-cgi input
then I wouldn't be able to access the values in the block using the path
notation in combination with the names: result/name wouldn't work
because in the block name appears as name:
result/name: wouldn't work because upon parsing a set-word as the last
element of a path REBOL expects that you are changing the value
following the word name and I would get an error reporting that the
value being assigned to result/name: is missing.
The one option would be to reduce the block returned by decode-cgi. Then
name and phone will become global words that are associated with their
respective values. I prefer to work with words that are local to the
object's context to avoic conflicts with other words that may be in use.
Hope this helps,
Elan
GS Jones wrote: