1. More about Euphoria CGIs (a succesful story!)
- Posted by Daniel Berstein <daber at PAIR.COM> Mar 03, 1999
- 528 views
I tried to execute the EuCGI without binding it. I was unsuccesful :( Here's the problem: Xitami recognize as a CGI a file that is located in a valid cgi directory (it must be configured on the server for security reasons) *and* must follow one of these criterias: a) Be a valid exe file (starts with MZ). b) Start with #! a space and followed by the full path of the interpreter (used by Perl and Awk scripts). c) Start with /*! a space and followed by the full path of the interpreter, and the last text in the line is */ (used by Rexx scripts). I made a silly test and put on the first line of my code: #! c:\euphoria\bin\exw.exe Half Eureka. The server recognized it as a CGI and spawned exw.exe... with the obvious error raised by Euphoria: C:\Xitami\cgi-bin\cgitest.exw:1 hex number not formed correctly #! c:\euphoria\bin\exw.exe So here is a new entry to 2.1 beta wish-list: Rob, please be so kind to just raise a Warning if the very first line of the code is either a Perl/Awk or Rexx style comment (I asume several other servers work a similar). Creating bounded EuCGI is functional, but storage of all those .exe files may not be desireable. Unregistered (yet) users may start playing with Euphoria for creating their own CGI's... you know, anything WWWebable is a commercial success ;) (at least for book publishers). *Attention* While writing this email an idea jumped of my mind: If Xitami reads the first line of a Perl/Awk script to get the interpreter path, then maybe I oculd fool it. So I created a blank new text document (with Notepad) and wrote: #! c:\euphoria\bin\exw.exe c:\xitami\cgi-bin\cgitest.exw Followed by a blank line. It worked! Xitami just called exw.exe with the first parameter as my EuCGI and as second (passed to my script's command line) the location of the "wrapper" text cgi. From now on I'll use this method for my EuCGI's. In fact I just moved eucgi.exw from the cgi-bin directory to c:\eucgi\eucgi.exw and instead put a wrapper file called eucgi (no extension) that says: #! c:\euphoria\bin\exw.exe c:\eucgi\eucgi The only withdraw of this method is that the current working directory is set where the wrapper is. if you need to get the path of the actual Euphoria code you could SET a variable on autoxec.bat (EUCGI_DIR?). Rob, why can't command_line give the path of unbounded files? Maybe my wish-list contribution should be ommited, but not the idea of making Euphoria more WWWebable. I apologize for this long and evolving post, it's one of those emails you write while coding and testing. Anyways I thought it may be useful to follow the nature of this "hack". Regards, Daniel Berstein [daber at pair.com]
2. Re: More about Euphoria CGIs (a succesful story!)
- Posted by Bernie Ryan <bwryan at PCOM.NET> Mar 03, 1999
- 527 views
Dan: Just an idea, Why not write a small filter/monitor program that would parse out the Perl/Awk or Rexx comments, etc. Then when you need to use Eucgi. You could spawn out a copy of Euphoria, do your processing, while handling your the directory problem at the same time. When Euphoria completes processing you would return to the monitor/filter. PS Guess what I received in the mail today, a 60 day free trial full_working version of the new Borland C++Builder 4 from Inprise.