Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] eRebol on Win32

From: john::schuhr::com at: 3-Jun-2001 13:13

In playing with the eRebol (rebol server pages) script by Maarten Koopmans, I had a few problems with it "out of the box" in running it on Apache/Win32. I thought I'd share my patches/hacks with anyone else who might consider playing with it as well. The documentation says to add the following to the httpd.conf file: AddAction erebol /cgi-bin/erebol_sample.r AddHandler erebol rhtml When in actuality, I had to alter it into: Action erebol /cgi-bin/erebol_sample.r AddHandler erebol .rhtml Notice the modified "Action" directive and the added "." to the AddHandler directive. Now, in the erebol_sample.r script which contains the function and the call to the function, Apache/Win32 didn't like the path name for the file it was processing. Apparently, just using 'to-file on Win32 returns C:\blah\blah.r which is an invalid filename in Rebol. So I had to modify the last line in the erebol_sample.r to read: erebol to-file replace system/options/cgi/path-translated "c:\" "/c/" So that it always had a "/c/blah\blah.r" filepath to work with. Additionally, I had to add the following lines before the line above: print "Content-Type: text/html" print "" print "" Otherwise, I got an Internal Server Error 500. Bleah. I've included the whole of the modified script, just for convenience. **SNIP** #!C:/rebol/rebol.exe -cs REBOL [ Title: "rebol Server pages" Date: 18-May-2001/9:18:36+2:00 Version: 1.0.0 File: %erebol.r Author: "Maarten Koopmans" Purpose: "Execute embedded rebol code, see" Email: [m--koopmans2--chello--nl] Category: [cgi markup text] ] print "Content-Type: text/html" print "" print "" erebol: func [ {Preprocesses a text file and evaluates al rebol code between <% and %> tags. Everything that is printed is visible in the output. <%# and %> comments code out (useful for debugging).} content [file! string!] /local text ] [ execs: false page-end: copy {} either file? content [ text: read content ] [ text: copy content ] ; two rules for parsing ; first the comment rule ; removes any comment between <%# and %>, useful for debugging comment-rule: [ copy pre to "<%#" cs: thru "%>" ce: (remove/part cs ((index? ce) - (index? cs)))] ; next, we copy anything that is between <% and %> and try to execute that ; we save the remainder of the page in page-end blok: [ do code ] bind blok 'do exec-rule: [ copy pre to "<%" thru "<%" copy code thru "%>" page-end: (execs: true prin pre error? try blok) ] bind exec-rule 'do ; now remove the comments parse text [ any comment-rule ] ; execute the commands parse text [any exec-rule] ;and... print the end of the page that doesn't contain any code either execs [ print page-end ] [ print text ] ] erebol to-file replace system/options/cgi/path-translated "c:\" "/c/" **END-SNIP**