----- Original Message -----
From: "Rich Mooney" <[EMAIL PROTECTED]>
To: "MetaCard Mail List" <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 3:35 PM
Subject: Can I put Multiple handlers in a CGI script?
> As I understand it, a CGI needs to be in the following format:
>
> #! mc
> on Startup
> #script
> end Startup
>
> I also have the impression that any script in this CGI had to be between "on
> Startup" and "end Startup".
Nope. The 'startup' message is the only message MC sends/fires in a CGI script (I
think), but it's just another Metatalk message and follows all the same rules as all
the others (no nested handlers). From within the 'startup' handler, you can reference
any number of other standard or custom handlers/functions/etc. Like this:
-- start of script --
on startup
if firstchar(the platform) = char 1 of the systemVersion then
doDance "Windows?"
else
doDance "Mac?"
end if
writeSomething
end startup
function firstChar pCharString
return char 1 of pCharString
end firstChar
on doDance pDanceType
tellSomeone "Are you running" && pDanceType
end doDance
on tellSomeone pMessage
put "Content Type: text/html" & cr \
& "Content Length:" && length(pMessage) & cr & cr
put pMessage
end tellSomeone
on writeSomething
put "Uhhhhh...."
end writeSomething
-- end of script --
> So does this mean that one CGI file is one handler and that I can't pass
> arguments to it or can I do something like this:
The 'startup' message has no params, but you can create other handlers in your CGI
script that use'em (see above).
Phil
>
> #! mc
> on Startup
> on handler1 param1 param2
> # do stuff
> end handler1
> function dosomething
> # do stuff
> end dosomething
> end Startup
>
> Rich Mooney
> Payne Sparkman Mfg.
> [EMAIL PROTECTED]
>
> _______________________________________________
> metacard mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/metacard
_______________________________________________
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard