[REBOL] How do I simulate CGI? Re:(2)

2000-01-20 Thread tjohnson

Thanks!! It worked.
Tim
At 02:47 PM 1/19/00 -0800, you wrote:
  
;;;query-string is redefined to simulate input from a form
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string

cgi: make object! decode-cgi query-string

will work in your example, as will

system/options/cgi/query-string:
"name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string


Explanation:

You are creating a global word query-string here =
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   

however you are passing decode-cgi a different query-string word embedded
in an object here:
cgi: make object! decode-cgi system/options/cgi/query-string

this .../cgi/query-string is a different query-string from your query-string.

This has to do with contexts. The object cgi, in the path system/options
has its own context and system/options/cgi/query-string is limited to the
cgi object's context (unless its context is extended by referencing it from
outside the cgi object. Don't worry about that just now.) When you create
query-string as a glocal word - which is what happens by default when you
do what you did - it does not affect the query-string in the context of cgi
object.

use probe system/options/cgi

to see the contents of the cgi object.

use =
system/options/cgi/query-string:
"name=tim[EMAIL PROTECTED]phone=9005551212"   

to more realistically simulate the situation you will encounter when you
run the script as a cgi script.

Hope this helps

;- Elan  [: - )]





[REBOL] [REBOL] How do I simulate CGI? Re:

2000-01-20 Thread tjohnson

Hi Elan:
Thanks for that tip. Actually, I use a 
multi-stage process (I've been using compiled
apps with C/C++);
1)First write and debug in a console mode, redirecting
  html stdout to a test file.
2)Then run with web browser against Microsoft
Personal Web Server.
3)Then port to server. 
In many cases, Rebol will be more suitable, and
I know that my approaches to the development
cycle may have to change.

My next step, I suppose, will be to configure
Microsoft Personal Web Server to work
with Rebol. Any tips or comments?
Regards
Tim

At 02:48 PM 1/19/00 -0800, you wrote:
At 12:28 PM 1/19/00 -0900, you wrote:
I am a CGI programmer new to Rebol.

In previous work, I have begun a project
by simulating the CGI environment on my
desktop and redirecting output from stdout 
to a file.

I have installed Apache on my MS Windows desktop machine and run a Web
browser against it to simulate cgi.

;- Elan  [: - )]





[REBOL] How do I simulate CGI?

2000-01-19 Thread tjohnson

I am a CGI programmer new to Rebol.

In previous work, I have begun a project
by simulating the CGI environment on my
desktop and redirecting output from stdout 
to a file.

How may I create a test query string to run
directly from my desktop?

The attempt that I made was to copy cgiform.r
and modify it as below: Rebol returns 
** Script Error: decode-cgi expected args argument of type: any-string.
** Where: cgi: make object! decode-cgi system/options/cgi/query-string
;
print "Content-Type: text/html^/"  ;-- Required Page Header
  
;;;query-string is redefined to simulate input from a form
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string

print   
[   
htmlbodyh2*"CGI Results:"/h2
"Name:"  B cgi/name /BP   
"Email:" B cgi/email /BP  
"Phone:" B cgi/phone /BP  
/bodyhtml   
]   




[REBOL] How do I simulate CGI? Re:

2000-01-19 Thread icimjs

  
;;;query-string is redefined to simulate input from a form
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string

cgi: make object! decode-cgi query-string

will work in your example, as will

system/options/cgi/query-string:
"name=tim[EMAIL PROTECTED]phone=9005551212"   
cgi: make object! decode-cgi system/options/cgi/query-string


Explanation:

You are creating a global word query-string here =
query-string: "name=tim[EMAIL PROTECTED]phone=9005551212"   

however you are passing decode-cgi a different query-string word embedded
in an object here:
cgi: make object! decode-cgi system/options/cgi/query-string

this .../cgi/query-string is a different query-string from your query-string.

This has to do with contexts. The object cgi, in the path system/options
has its own context and system/options/cgi/query-string is limited to the
cgi object's context (unless its context is extended by referencing it from
outside the cgi object. Don't worry about that just now.) When you create
query-string as a glocal word - which is what happens by default when you
do what you did - it does not affect the query-string in the context of cgi
object.

use probe system/options/cgi

to see the contents of the cgi object.

use =
system/options/cgi/query-string:
"name=tim[EMAIL PROTECTED]phone=9005551212"   

to more realistically simulate the situation you will encounter when you
run the script as a cgi script.

Hope this helps

;- Elan  [: - )]



[REBOL] How do I simulate CGI? Re:

2000-01-19 Thread icimjs

At 12:28 PM 1/19/00 -0900, you wrote:
I am a CGI programmer new to Rebol.

In previous work, I have begun a project
by simulating the CGI environment on my
desktop and redirecting output from stdout 
to a file.

I have installed Apache on my MS Windows desktop machine and run a Web
browser against it to simulate cgi.

;- Elan  [: - )]