Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CGI and JSON

234 views
Skip to first unread message

Kevin Walzer

unread,
Dec 15, 2011, 8:52:00 AM12/15/11
to
I'm working on a project that will involve setting up a server-side Tcl
package that will return JSON data for parsing by a JavaScript client. A
few questions:

1. What's the best way to handle CGI these days--Don Liebes' cgi.tcl
package, ncgi in tcllib, or something else?
2. I know there there is a json package in tcllib that can parse JSON
output, but are there any tools in Tcl for generating JSON output from a
Tcl data structure?

--Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

Gerald W. Lester

unread,
Dec 15, 2011, 10:52:17 AM12/15/11
to
On 12/15/11 7:52 AM, Kevin Walzer wrote:
> I'm working on a project that will involve setting up a server-side Tcl
> package that will return JSON data for parsing by a JavaScript client. A few
> questions:
>
> 1. What's the best way to handle CGI these days--Don Liebes' cgi.tcl
> package, ncgi in tcllib, or something else?

ncgi


--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+------------------------------------------------------------------------+

Kevin Walzer

unread,
Dec 15, 2011, 10:59:46 AM12/15/11
to
On 12/15/11 10:52 AM, Gerald W. Lester wrote:
> On 12/15/11 7:52 AM, Kevin Walzer wrote:
>> I'm working on a project that will involve setting up a server-side Tcl
>> package that will return JSON data for parsing by a JavaScript client.
>> A few
>> questions:
>>
>> 1. What's the best way to handle CGI these days--Don Liebes' cgi.tcl
>> package, ncgi in tcllib, or something else?
>
> ncgi
>
>
Care to elaborate on why?

Gerald W. Lester

unread,
Dec 15, 2011, 1:44:59 PM12/15/11
to
On 12/15/11 9:59 AM, Kevin Walzer wrote:
> On 12/15/11 10:52 AM, Gerald W. Lester wrote:
>> On 12/15/11 7:52 AM, Kevin Walzer wrote:
>>> I'm working on a project that will involve setting up a server-side Tcl
>>> package that will return JSON data for parsing by a JavaScript client.
>>> A few
>>> questions:
>>>
>>> 1. What's the best way to handle CGI these days--Don Liebes' cgi.tcl
>>> package, ncgi in tcllib, or something else?
>>
>> ncgi
>>
>>
> Care to elaborate on why?
>

Don's CGI was split into ncgi and html in tcllib and has had bug fixes done
since -- not sure if Don has also applied the fixes.

ncgi and html are what most people have been using for a couple of years now.

Glenn Jackman

unread,
Dec 16, 2011, 8:46:38 AM12/16/11
to
At 2011-12-15 08:52AM, "Kevin Walzer" wrote:
> 2. I know there there is a json package in tcllib that can parse JSON
> output, but are there any tools in Tcl for generating JSON output from a
> Tcl data structure?

There's some sample code for generating JSON here:
http://rosettacode.org/wiki/JSON#Tcl


--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous

Andreas Kupries

unread,
Dec 16, 2011, 12:08:44 PM12/16/11
to
Kevin Walzer <k...@codebykevin.com> writes:

> I'm working on a project that will involve setting up a server-side
> Tcl package that will return JSON data for parsing by a JavaScript
> client. A few questions:
>
> 1. What's the best way to handle CGI these days--Don Liebes' cgi.tcl
> package, ncgi in tcllib, or something else?
> 2. I know there there is a json package in tcllib that can parse JSON
> output, but are there any tools in Tcl for generating JSON output from
> a Tcl data structure?

Under the json module you should also find a json::write package.

http://docs.activestate.com/activetcl/8.5/tcllib/json/json_write.html

--
So long,
Andreas Kupries <akup...@shaw.ca>
<http://www.purl.org/NET/akupries/>
Developer @ <http://www.activestate.com/>
18'th Annual Tcl/Tk Conference: 2011, Manassas, VA USA
http://www.tcl.tk/community/tcl2011/
-------------------------------------------------------------------------------

Kevin Walzer

unread,
Dec 16, 2011, 8:51:32 PM12/16/11
to
On 12/16/11 12:08 PM, Andreas Kupries wrote:
> Kevin Walzer<k...@codebykevin.com> writes:
>
>> I'm working on a project that will involve setting up a server-side
>> Tcl package that will return JSON data for parsing by a JavaScript
>> client. A few questions:
>>
>> 1. What's the best way to handle CGI these days--Don Liebes' cgi.tcl
>> package, ncgi in tcllib, or something else?
>> 2. I know there there is a json package in tcllib that can parse JSON
>> output, but are there any tools in Tcl for generating JSON output from
>> a Tcl data structure?
>
> Under the json module you should also find a json::write package.
>
> http://docs.activestate.com/activetcl/8.5/tcllib/json/json_write.html
>

Thanks for the pointer here--will give this a try.
0 new messages