Discrimination of Forth versus perl

Discussion in 'Perl' started by Albert van der Horst, Apr 26, 2005.

  1. 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.
    4all.nl http://home.hccnet.nl/a.w.m.van.der.horst
    Albert van der Horst, Apr 26, 2005
    #1
    1. Advertising

  2. In article <4all.nl>,
    Albert van der Horst <4all.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.
    4all.nl http://home.hccnet.nl/a.w.m.van.der.horst
    Albert van der Horst, Apr 26, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    6,911
    Scott M.
    Oct 11, 2003
  2. Russ

    script versus code versus ?

    Russ, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,497
  3. Replies:
    0
    Views:
    472
  4. John Doty
    Replies:
    42
    Views:
    861
    Elizabeth D Rather
    Oct 16, 2006
  5. Paul Butcher
    Replies:
    12
    Views:
    708
    Gary Wright
    Nov 28, 2007
Loading...

Share This Page