Re: [q-lang-users] Avoiding trailing () in CGIs
Brought to you by:
agraef
From: Tim H. <q...@st...> - 2004-06-29 22:56:25
|
Dr....@t-... (Albert Graef) writes: > > The problem is, if I write something like this: [snip] > > then obviously my webpage comes out with `()' on the bottom. This > > invalidates the generated RSS stream or XHTML page. > > Solution: Either terminate your main function with something like `quit' > or `exit 0' (i.e., main ARGS =3D writes PAGE || quit;), or add this to the > -c line (e.g., #! -c main ARGS||quit). This causes the interpreter to > exit before it prints the result expression. > > Hope this helps! Most excellent. Hadn't thought of that. Works a treat. Scripts duly updated. Thanks :) > > I'm playing around with Q for use as web CGIs - scripts build up XML > > data and transform it with sablotron prior to printing it out. > > Interesting! I'm contemplating the idea to write an XML parser/unparser > module for Q, but as I don't know much about XML I could use some > assistance. Willing to help? Well, I'm not convinced I know that much about it either, but I'd be happy to pass on the scripts & sablotron glue I've got so far - where would you like them? - the basic gist is that, given a database query result-set via ODBC, I convert this [(colname1,colname2), (row1col1, row1val1)...] into XML with a recursive function whose first parameter is a list of node-names for different depths (["xml","row","field"], typically). However, this is not clever in the slightest - it's all done with strings when ideally it should be a type in its own right with an appropriate index =2D but my Q is not so advanced[0] that I'd know how to implement such a thing. Also, I've wimped-out and used a fixed-length buffer and a deprecated function in the sablotron API(!)... but these things are what v2.0 is for ;) [0] I've only been using it on & off since I saw the 5.3 announcement on freshmeat - hi folks! ~Tim =2D-=20 <http://spodzone.org.uk/> |