Using stacks in MC CGI scripts...
OK getting back to some CGI stuff... Help from all you experts out there required. I have an MC based CGI working but when I use the following lines within the standard "echo.mt" test script I get errors: -- go to stack "database.mc" -- error -- start using stack "database.mc" -- no problem but... -- put getData() into buffer -- error Now getData() is a very simple function in the stack script of the MC stack "database.mc" on the server - it just return "hello" I am not clear what can and can't be done with these scripts as I had largely worked with MC based server stuff where it is all possible, so anyone help with my confusion??? Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list.
Re: Using stacks in MC CGI scripts...
David Bovill wrote: OK getting back to some CGI stuff... Help from all you experts out there required. I have an MC based CGI working but when I use the following lines within the standard "echo.mt" test script I get errors: -- go to stack "database.mc" -- error Go wants to "open" a stack which you probably don't want. -- start using stack "database.mc" -- no problem but... Start using "database" should be enough. -- put getData() into buffer -- error Be aware that the 2 stacks don't share local variables. One stack does getData() and "returns" stuff, the other, gets stuff in "the result". Now getData() is a very simple function in the stack script of the MC stack "database.mc" on the server - it just return "hello" I am not clear what can and can't be done with these scripts as I had largely worked with MC based server stuff where it is all possible, so anyone help with my confusion??? Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list. Andu Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list.
Re: Using stacks in MC CGI scripts...
David Bovill wrote: OK getting back to some CGI stuff... Help from all you experts out there required. I have an MC based CGI working but when I use the following lines within the standard "echo.mt" test script I get errors: -- go to stack "database.mc" -- error Go wants to "open" a stack which you probably don't want. -- start using stack "database.mc" -- no problem but... Start using "database" should be enough. -- put getData() into buffer -- error Be aware that the 2 stacks don't share local variables. One stack does getData() and "returns" stuff, the other, gets stuff in "the result". Now getData() is a very simple function in the stack script of the MC stack "database.mc" on the server - it just return "hello" I am not clear what can and can't be done with these scripts as I had largely worked with MC based server stuff where it is all possible, so anyone help with my confusion??? Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list. Andu Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list.
Re: Using stacks in MC CGI scripts...
From: andu [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Mon, 16 Apr 2001 08:55:18 -0400 To: [EMAIL PROTECTED] Subject: Re: Using stacks in MC CGI scripts... David Bovill wrote: -- start using stack "database.mc" -- no problem but... Start using "database" should be enough. -- put getData() into buffer -- error Be aware that the 2 stacks don't share local variables. One stack does getData() and "returns" stuff, the other, gets stuff in "the result". Now getData() is a very simple function in the stack script of the MC stack "database.mc" on the server - it just return "hello" I am not clear what can and can't be done with these scripts as I had largely worked with MC based server stuff where it is all possible, so anyone help with my confusion??? Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list. Hi Andu... I don't have two stacks... just the one and it is being "used" in the .mt script - by the "start using stack ..." line. However i can't use any of the functions in this stacks script even though I can reference it's fields and data Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list.
Re: Using stacks in MC CGI scripts...
David Bovill wrote: From: andu [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Mon, 16 Apr 2001 08:55:18 -0400 To: [EMAIL PROTECTED] Subject: Re: Using stacks in MC CGI scripts... David Bovill wrote: -- start using stack "database.mc" -- no problem but... Start using "database" should be enough. -- put getData() into buffer -- error Be aware that the 2 stacks don't share local variables. One stack does getData() and "returns" stuff, the other, gets stuff in "the result". Now getData() is a very simple function in the stack script of the MC stack "database.mc" on the server - it just return "hello" Hi Andu... I don't have two stacks... just the one and it is being "used" in the .mt script - by the "start using stack ..." line. Same thing. However i can't use any of the functions in this stacks script even though I can reference it's fields and data So, the syntax is the problem. After you "start using" a stack do a handler in the stack not a function. In your .mt file: ...start using "database" getMyStuff put the result ... In your stack script: on getMyStuff put getData() into buffer return buffer end getMyStuff function getData() #stuff end getData Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list.
Re: Using stacks in MC CGI scripts: experience of (1)...
David Bovill wrote: Thanks Andu, got it working (with your help). I had made a number of mistakes... 1) The function had a mistake: function getData -- put return fld 1 into someData put return fld 1 of stack "database" into someData return someData end getData Basic mistake, but as the script is being used, it had no idea of which stack the field was in - so a stack reference was needed. However you can call the functions direct (which is a relief for me 'coz my libraries are mainly functions). Seem to be able to parameters in the expected way. However I've run into a problem which seems to be to do with the home stack... pretty sure it is not corrupted or anything as it works locally and I am using the same technique to transfer it as the other stacks... - I think it is *that* lovely splash screen -:) Why would I want to use the home stack Good question. - maybe I don't need to, but when exploring shell commands, I decided to see if I could use MC shell commands and call them from the CGI... Stuff like (calling standard shell scripts on Linux serveer): -- put shell("whereis sh") after buffer -- put return after buffer -- put shell("whereis mc") after buffer -- put return after buffer -- put shell("whereis perl") after buffer -- put return return after buffer Works a treat in the CGI, but when I tried to use MC based scripts... First I got back that sh (the shell interpreter) couldn't handle it, so I needed to change the shellCommand... -- set the shellcommand to "mc" to which I get back... -- ...mcPath: Can't open display -- ...mcPath: Can't load stack or script mchome.mc Which brings me on th the fact that with the home stack on the server and a couple of database stacks: -- put fld 1 of stack "database" into someData -- works fine -- put fld 1 of stack "home" into someData -- gives a server error So the question I am trying to answer is have I made another silly mistake or am I running into a brick wall as the home stack will not run on the server (display issue?) and consequently I won't be able to use MC based shell scripts? You can if they are written to a .mt file. % ./mc script.mt # will execute the script. Doing: % ./mc stack.mc #will try to open MC in X and not succeed. Maybe I'll have to dig out that SSH Telnet client? Any help from the experts out there appreciated... David Andu Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list.
Re: Using stacks in MC CGI scripts: experience of (1)...
David Bovill wrote: OK not quite clear... (Linux novice -:) You can if they are written to a .mt file. Can be any file name as long as the permissions are set to execute and the file is on the $PATH right? If you're not in the directory with the file you have to point to it (% mc /home/users/www/cgi-bin/script.mt) "%, $, #" stay for the promt sign which in my case is # (they are not part of your command). If the application is not on the $PATH you must point to it; same for the script file: % /usr/local/bin/mc /home/users/www/script.mt If you're in the same directory with mc and mc is not on the $PATH you do: %./mc script.mt (or the path to the script). % ./mc script.mt # will execute the script. Has this come through the email correct? What do I issue from an MC .mt CGI script (or other CGI language? Lets take MC as an example: put shell("% ./mc script.mt") into mcShellResult So, if mc is on the path you do: put shell("mc /path/to/the/script.mt") The preffix of the file can be anything not just .mt. Doing: % ./mc stack.mc #will try to open MC in X and not succeed. OK Thanks again. You're welcome. Andu Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to [EMAIL PROTECTED], not this list.