Web programming progress report
Mark Talluto
lists at canelasoftware.com
Fri May 2 18:07:00 EDT 2003
On Friday, May 2, 2003, at 10:26 AM, andu wrote:
>> Monte endorsed Andu's solution and in his several responses
>> tantalized me
>> into thinking Metacard can be leveraged to do what I want. My personal
>> concern is wether or not as an individual developer with my limited
>> resources can I leverage Metacard to do this? Of, course I have to
>> take
>> responsibility to learn and study a great deal more on my own but,
>> would
>> someone be willing to elaborate a little more on how one goes about
>> implementing the solution Andu and Monte have presented?
>
> Here's what happens:
> When you click on a "Submit" button on a web page in your browser the
> forms data is sent to a MC cgi script via the web server. The script
> reads and processes the data (calculates things, gets/puts things
> from/to a database, combines different html templates, etc.) and sends
> it back to the server which sends it back to your browser as an html
> formated page.
> (Others who explored this mechanism more recently should be better fit
> to provide you with details)
Mark,
I am not sure if you want something this basic, but her goes. I too am
just getting into this very exciting aspect of MC. I have only been
playing with cgis for a few days now. The example I am about to
present came from Ken Rays websitea:
http://www.sonsothunder.com/devres/metacard/tips/cgi001.htm
I got this link by the way (ironically) from Richard's RevNet. This
app runs outside the browser and best shows what can be done when you
are not constrained by the browser. From this app there is a tips
button. Inside there there is a single CGI example (Ken's).
My test setup includes two computers, but this can be done with just
one.
Mac OS X which comes with Apache already installed. You do not even
need the server version of X, the client will do.
Step 1
1. copy the following script into a text editor. I used bbedit, but
simple text will work as well. Save the file as for example:
simple-cgi
#!mc
on startUp
put "Hello World!" into tResponse
put "Content-Type: text/html" & crlf
put "Content-Length:" & (the length of tResponse) & crlf & crlf
put tResponse
end startUp
Step 2
1. Place the above text file into the cgi-bin folder. I believe this
file can go into other places, but I do not understand how to do that
yet. This folder is located in the: hard
drive/Library/WebServer/CGI-Executables
Step 3
1. Get the appropriate MC engine in the same folder as the script
above. Because the server we are using is OS X in this example, you
need to download the "darwin.tar" file from MC's website. Decompress
that till you get the "mc" file.
2. Once you copy it over, you need to set its permissions of both the
engine and the script to 755.
Step 4
Test it out by opening up your browser on the same machine or remote
for that matter. If the server is at: 192.168.1.0 then the url is:
192.168.1.0/cgi-bin/simple-cgi
You should see: "Hello World!" in your browser.
This is the most basic example for a cgi script using MC and Apache.
Best regards,
Mark Talluto
http://www.canelasoftware.com
More information about the metacard
mailing list