By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,887 Members | 1,003 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,887 IT Pros & Developers. It's quick & easy.

Discrimination of Forth versus perl

P: n/a
I am trying to do some web scripting in Forth
This is a transcript of the perl
example from O'Reilly (Gundavaram) CGI-programming pg. 17.

With the multiple line strings and the occasional
auxiliary word, it looks neater than perl IMO.

However, no environment variables can be accessed from the
script apparently. The corresponding perl script has no
such problems. (Environment available in an associative
array %ENV ).
What is going on here?

[For those unacqainted with CGI, these are scripts that
generates html "on the file". With variable content.]
---------8<----------------8<--------------
#!/usr/bin/lina -s

\ Using server site scripting in Forth.

\ ---------- requisites -----------------
REQUIRE GET-ENV
\ Print environment variable from its NAME.
: .ENV GET-ENV TYPE "<BR>" TYPE CR ;

\ --------- push the scripts prelude --------------
"Content-type: text/html

<HTML>
<HEAD><TITLE> About this server</TITLE></HEAD>
<BODY>
<H1>About this server</H1>
<HR>Welcome to Albert's brave new world of Forth scripting!<HR>
<PRE>
" TYPE

\ --------- push information ---------------------
"Server Name: " TYPE "SERVER_NAME" .ENV
"Running on port: " TYPE "SERVER_PORT" .ENV
"Server SOFTWARE: " TYPE "SERVER_SOFTWARE" .ENV
"Server PROTOCOL: " TYPE "SERVER_PROTOCOL" .ENV
"CGI Revision: " TYPE "GATEWAY_INTERFACE" .ENV
"Server Name: " TYPE "SERVER_NAME" .ENV
"PATH Name: " TYPE "PATH" .ENV

\ --------- push the scripts postlude --------------
"</PRE>
</BODY>
</HTML>
" TYPE
---------8<----------------8<--------------
--
--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
al****@spenarnc.xs4all.nl http://home.hccnet.nl/a.w.m.van.der.horst
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <if********@spenarnc.xs4all.nl>,
Albert van der Horst <al****@spenarnc.xs4all.nl> wrote:
I am trying to do some web scripting in Forth
This is a transcript of the perl
example from O'Reilly (Gundavaram) CGI-programming pg. 17.

With the multiple line strings and the occasional
auxiliary word, it looks neater than perl IMO.

However, no environment variables can be accessed from the
script apparently. The corresponding perl script has no
such problems. (Environment available in an associative
array %ENV ).
What is going on here?


I goofed. Apparently the implementation of ENV is broken.

With a redefinition of ENV (a ciforth specific dirty
hot patch) the script works:

\ Mysterious hot patch of ENV
: ENV' OLD: ENV 2 CELLS + ;
'ENV' 'ENV 3 CELLS MOVE

No discrimination agains Forth here.

<Script SNIPPED, see previous post>

Groetjes Albert

--
--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
al****@spenarnc.xs4all.nl http://home.hccnet.nl/a.w.m.van.der.horst
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.