command-line/CGI Revolution engine questions
Pierre Sahores
psahores at easynet.fr
Mon Sep 1 16:04:01 EDT 2003
Le lun 01/09/2003 à 19:56, Alex Rice a écrit :
> I just downloaded the 2.0 revolution engine for Darwin (OS X) from
> ftp.runrev.com.
>
> 1) It requires installation of nonstandard shared libraries X11 and
> libdl. The darwin engine "mc" available from metacard.com does not have
> this problem. Why the difference? I already had X11 installed and
> compiling libdl right now. I am just surprised I have to compile
> something to get the revolution engine to work.
>
> 2) I tried the following as an experiment.
>
> sudo cp revolution /usr/local/bin/mc
> create mainstack in Rev IDE, save as filename "fu.rev"
> write a handler in the stack
>
> on startup
> put "hello world"
> put linefeed
> end startup
>
> # chmod +x fu.rev
> # ./fu.rev
>
> external startup
> mc: Can't open display
> mc: Can't load stack or script ./fu.rev
To run in the cgi way (console mode - no X display needed at all),
"fu.rev" don't have to be saved as a stack but as a .txt file. To get it
available as a regular cgi script, a ".rev" (or the other extension of
your choice) addhandler entry need to be added to the "httpd.conf"
Apache config file, like below :
> # To use CGI scripts:
> #
> #AddHandler cgi-script .cgi
> AddHandler cgi-script .rev
> Anyone know why the shell script front end that appears in each MC
> stack does not work on OS X? Does it work on Linux? Maybe I am not
> understanding the intent of this mini shell script that appears at the
> beginning of every Rev stack. Here it is.
This don't have to do with the way we can start the stack under Linux,
as cgi or, even, as long console-mode process at boot time, like below :
> #!/bin/sh
> # Start/stop WMCASERVER
>
> case "$1" in
> 'start')
> killall -1 aserverstart
> /usr/local/httpd/celia/aserver/aserverstart &
> ;;
> 'stop')
> killall -1 aserverstart
> ;;
> *)
> echo "Usage: $0 { start | stop }"
> ;;
> esac
> exit 0
where the upon code is stored in a txt file and "aserverstart"
is a second txt file containing the code below :
> #!/home/oscar/mc
> on startup
> open stack "/usr/local/httpd/celia/iassd/aserver.mc"
> end startup
where asserver.mc (work the same way with .rev stacks) is a standard GUI builded stack witch contains the minimal server app code, like below :
> on newconnect s # reading the request from a new socket
> read from socket s for 1 line with message "serverread" -- socket opened by a cgi, perl or php sockets listener
> end newconnect
>
> on serverread x,y # processing the request
> global PostIn,Retour,Lepath
> put urldecode(y) into PostIn # données POST reçues de wmc.xml
> put cr into char (length(PostIn))-1 to (length(PostIn)) of PostIn
> put "" into Retour
> set itemdelimiter to "&"
> WASSwitch -- YOUR CUSTOM STATEMENTS GOES THERE
> write Retour to socket x
> close socket x # x = adresse IP & "|" & n° d'ordre du socket fils reçu de wmc.xml
> try
> put the hostAddressToName of char 5 to -1 of item 3 of PostIn into ppa
> catch errornum
> put char 5 to -1 of item 3 of PostIn into ppa
> end try
> open file Lepath & "logaserver.txt" for append
> write the date && the long time && item 1 of PostIn && char 5 to -1 of item -2 of PostIn && line 1 of opensockets() && \
> ppa && "200 OK" & cr to file Lepath & "logaserver.txt"
> repeat
> if the num of lines in (opensockets()) > 1
> then close socket line 2 of (opensockets())
> else exit repeat
> end repeat
> end serverread
> #!/bin/sh
> # MetaCard 2.4 stack
> # The following is not ASCII text,
> # so now would be a good time to q out of more^L
> exec mc $0 "$@"
The five line upon are reserved to the private use of the stacks by the
engine.
>
> This, however, does work ok:
>
> #!/usr/local/bin/mc
> on startup
> put "hello world"
> put linefeed
> end startup
>
> Now I understand why the previous poster (I'm bad with names) was doing
> like this
>
> #!/usr/local/bin/mc
> start using stack "some.rev"
>
> 3) The 2.1 command-line/CGI engines are not available?
>
> 4) Is there an Emacs mode for metacard and/or xtalk languages
> languages? My version of emacs thinks a .mc script is for M4 macro mode
> :-/
>
> Alex Rice <alex at mindlube.com> | Mindlube Software | http://mindlube.com
>
> what a waste of thumbs that are opposable
> to make machines that are disposable -Ani DiFranco
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
Hope this help,
--
Bien cordialement, Pierre Sahores
Inspection académique de Seine-Saint-Denis
Applications et SGBD ACID SQL (WEB et PGI)
Penser et produire "delta de rentabilité"
More information about the use-livecode
mailing list