Archive for the ‘Rebol’ Category

Rebol 3.0 and join with URL!

Monday, July 2nd, 2007

The Rebol list has rejected this post:

; there is an opportunity to review
; join a-url value-or-block
join http://www.rebol.com/request 42
; == http://www.rebol.com/request42
; this might be more useful as
; == http://www.rebol.com/request?42
: so as to permit
join http://www.rebol.com/request [refid store]
; http://www.rebol.com/request?refid=1253df&store=135

Just ask what kinds of values can join to a valid url to give a valid url

This arose from the consideration that

>> join <p> “/” ; result == <p/>
; makes sense, but
>>join <p> <div> ; == <p<div>>   does not make sense
; and that today our
join <> 1 2 (<> 1 2) ; == truetrue
; but requiring join op to be join parens op, i.e.,
join (<> 1 2) (<> 1 2) ; would then permit
join <> p
join <p> {color=”red”} ; etc etc
join <p/> {color=”red”} ; is currently silly result <p/color=”red”>

; or drop join for the tag! datatype ( join is any to any at present )

join <p> ["color" "red"] ; I rest my case as far as Rebol/core is concerned

; Rebol/command is the horse of another color (green when USD)

Rebol CGI gremlin under Apache2

Monday, June 11th, 2007

Very little is required to run Rebol CGI scripts under Apache’s HTTP server if you are already running Perl or PHP scripts.

What spooked me was a peculiar echo in my HTML page of

Content-Type: html/text

which I could not shake.

There was an explanation. On my first test I used the singularly unimaginative file name of rebol.r just to be sure that I did not need to use a CGI file extension, e.g., rebol.cgi

Because my initial rebol.r worked fine, I went on to try test_002.r and my problems began …

It turns out that even in a /cgi-bin directory, if Rebol finds a file called Rebol.r then that file is executed before your own file.

Now this could be useful as a default header for all rebol CGI scripts in that directory. But if a script contains its own

prin “Content-Type: text/html”

the ghost will have been inserted into the machine.

Once I had renamed rebol.r to rebol_0001.r all was well. The following test script works fine:

#!I:/rebol/core/rebol.exe -cswq
Rebol [
Title: "CGI test 004"
]
prin "content-type: text/html^/^/"

comment {filename is rebol_004.r
test URl is http://localhost:8080/cgi-bin/Rebol_004.r
}

html32: make string! 2048

emitr: func [dat] [repend html32 dat]

emitr [{ html header goes here} ]

emitr [{ some dynamic html goes here
}]

emitr: [{closing html tags go here}]

prin html32

On with Rebolting Web Pages!