For Programmers: Free Programming Magazines  


Home > Archive > Tcl > November 2006 > Working example of ncgi usage









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Working example of ncgi usage
Merrilee Larson

2006-11-26, 10:01 pm

Hi....

This newbee is having one heck of a time finding specific CGI example code
for TCL. I did look at cgi.tcl, but respectfully, its *not* what I'm looking
for. I want to use something as simple as Perl's CGI.pm. I think that *ncgi*
would do for me. However I need to review some CGI app, first as a sandbox to
learn both TCL and ncgi. Could somebody suggest some code.

BTW, <rant> *please* don't point me to some bloody wiki. I hate them with a
purple passion. There like navigating in a maze, i.e., they do *exactly* what
a proper web page should not do. </rant> TIA.....
--
duke
Gerald W. Lester

2006-11-27, 4:10 am

Merrilee Larson wrote:
> Hi....
>
> This newbee is having one heck of a time finding specific CGI example code
> for TCL. I did look at cgi.tcl, but respectfully, its *not* what I'm looking
> for. I want to use something as simple as Perl's CGI.pm. I think that *ncgi*
> would do for me. However I need to review some CGI app, first as a sandbox to
> learn both TCL and ncgi. Could somebody suggest some code.
>
> BTW, <rant> *please* don't point me to some bloody wiki. I hate them with a
> purple passion. There like navigating in a maze, i.e., they do *exactly* what
> a proper web page should not do. </rant> TIA.....


Since you don't like wikis, I'd suggest buying and reading the following books:

Brent Welch's book "Practical Programming in Tcl and Tk"

JM Ivler's book "CGI Developer's Resource - Web Programming in Tcl and Perl"

I also suggest reading the man/help pages for ncgi at
http://tcllib.sourceforge.net/doc/ncgi.html

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Merrilee Larson

2006-11-27, 4:10 am

On 2006-11-27, Gerald W. Lester <Gerald.Lester@cox.net> wrote:
> Merrilee Larson wrote:
>
> Since you don't like wikis, I'd suggest buying and reading the following books:
>
> Brent Welch's book "Practical Programming in Tcl and Tk"
>
> JM Ivler's book "CGI Developer's Resource - Web Programming in Tcl and Perl"
>
> I also suggest reading the man/help pages for ncgi at
> http://tcllib.sourceforge.net/doc/ncgi.html
>


Thanks for the references. I've already been to the above URL. It's a good
start! I might just have to by the books if I persist with TCL. I suppose that
the apparant lack of CGI code out there suggests that Web programming using TCL
has never quite caught on. Either that or TCL CGI scripts have never been made
available to the community. I suppose I'm using the availability of PHP and
Perl code in comparison. Too bad! Thanks....
--
duke
Darren New

2006-11-27, 4:10 am

Merrilee Larson wrote:
> the apparant lack of CGI code out there suggests that Web programming using TCL
> has never quite caught on. Either that or TCL CGI scripts have never been made
> available to the community.


Um, what are you looking to do? This sort of thing is very
straightforward in Tcl. I did an entire multi-seller e-commerce shopping
mall 12 years ago in Tcl with CGI.

--
Darren New / San Diego, CA, USA (PST)
Scruffitarianism - Where T-shirt, jeans,
and a three-day beard are "Sunday Best."
Uwe Klein

2006-11-27, 4:10 am

Merrilee Larson wrote:
> Hi....
>
> This newbee is having one heck of a time finding specific CGI example code
> for TCL. I did look at cgi.tcl, but respectfully, its *not* what I'm looking
> for. I want to use something as simple as Perl's CGI.pm. I think that *ncgi*
> would do for me. However I need to review some CGI app, first as a sandbox to
> learn both TCL and ncgi. Could somebody suggest some code.
>
> BTW, <rant> *please* don't point me to some bloody wiki. I hate them with a
> purple passion. There like navigating in a maze, i.e., they do *exactly* what
> a proper web page should not do. </rant> TIA.....
> --
> duke

You may want to culture your purplishness and go to:
http://wiki.tcl.tk/2?CGI*

or for general questions:
http://wiki.tcl.tk/2

it is not like any other wiki ;-))

uwe
Uwe Klein

2006-11-27, 4:10 am

Merrilee Larson wrote:

> Thanks for the references. I've already been to the above URL. It's a good
> start! I might just have to by the books if I persist with TCL. I suppose that
> the apparant lack of CGI code out there suggests that Web programming using TCL
> has never quite caught on. Either that or TCL CGI scripts have never been made
> available to the community. I suppose I'm using the availability of PHP and
> Perl code in comparison. Too bad! Thanks....
> --

Lots of published examples may just mean that usage is difficult enough
that users have enough pride in their accomplishment to make publishing worthwhile.

Tcl/Tk is the essence of RAD ;-)

> duke

uwe
Gerald W. Lester

2006-11-27, 8:03 am

Merrilee Larson wrote:
> On 2006-11-27, Gerald W. Lester <Gerald.Lester@cox.net> wrote:
>... I suppose that
> the apparant lack of CGI code out there suggests that Web programming using TCL
> has never quite caught on. Either that or TCL CGI scripts have never been made
> available to the community. I suppose I'm using the availability of PHP and
> Perl code in comparison. Too bad! Thanks....


No it means we tend to publish stuff on the wiki.tcl.tk which you stated you
did not want to look at.

The thing is, with ncgi.tcl it is so very simple to do that a unlike with
PHP or Perl you don't need a lot of published code.

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Merrilee Larson

2006-11-27, 7:05 pm

On 2006-11-27, Uwe Klein <uwe_klein_habertwedt@t-online.de> wrote:
> Merrilee Larson wrote:
> You may want to culture your purplishness and go to:
> http://wiki.tcl.tk/2?CGI*
>
> or for general questions:
> http://wiki.tcl.tk/2
>
> it is not like any other wiki ;-))


BTW, there's nothing wrong with *my* culture. As I'm new to this community,
I'll politely let it go at that.

Re: your first URL above, I'd say that 95% of the links are broken or obsolete.

Re: the wiki.tcl search engine -- I searched for "ncgi" - a library included in
the ActiveTCL distro. Nada! NADA!

I Googled ncgi+TCL --> no joy!

http://wiki.tcl.tk/1389 says:

"cgilib.tcl from Brent Welch's BOOK Practical Programming in Tcl and Tk, Third
edition. ncgi is descended from and largely supersedes cgilib."

So my question to the TCL community remains:

Anybody ever used "ncgi"? Any examples (guestbook, etc) code available for
study? TIA...
--
duke
Merrilee Larson

2006-11-27, 7:05 pm

On 2006-11-27, Darren New <dnew@san.rr.com> wrote:
> Merrilee Larson wrote:
>
> Um, what are you looking to do? This sort of thing is very
> straightforward in Tcl. I did an entire multi-seller e-commerce shopping
> mall 12 years ago in Tcl with CGI.
>


I've done quite a bit of CGI stuff in Perl and PHP. I'm looking for a library
or module that does *just* CGI parsing/decoding and of course the proper
header. cgi.tcl and cgilib.tcl both include HTML parsing that I don't want to
bloat my scripts with. I found the "ncgi" library in the ActiveTCL distro. I
simply need an example application that uses "ncgi" for several reasons:
1. to learn TCL programming
2. to learn the TCL-way of doing CGI programming
3. to evaluate TCL to see if *I'm* compatible with it.
--
duke
suchenwi

2006-11-27, 7:05 pm


Merrilee Larson schrieb:

> Re: the wiki.tcl search engine -- I searched for "ncgi" - a library included in
> the ActiveTCL distro. Nada! NADA!


The most straightforward approach, appending the search term directly
to the Wiki URL, brings some success with http://wiki.tcl.tk/ncgi which
again leads to the man page http://tcllib.sourceforge.net/doc/ncgi.html

Uwe Klein

2006-11-27, 7:05 pm

Merrilee Larson wrote:
> On 2006-11-27, Uwe Klein <uwe_klein_habertwedt@t-online.de> wrote:
>
>
>
> BTW, there's nothing wrong with *my* culture. As I'm new to this community,
> I'll politely let it go at that.

Hrm, Hrm, haha.
>
> Re: your first URL above, I'd say that 95% of the links are broken or obsolete.

You may want to reconsider that statement.
>
> Re: the wiki.tcl search engine -- I searched for "ncgi" - a library included in
> the ActiveTCL distro. Nada! NADA!

If you really had entered "ncgi" as search you would have been led to:
http://wiki.tcl.tk/780
the same with "ncgi*" ( i.e. search for "ncgi" in the content of all pages
would have given you ~27 references.

>
> I Googled ncgi+TCL --> no joy!

Which google did you use? google-mars?

with this query:
http://www.google.com/search?q=ncgi+TCL

google hands me about 22 pages of links ( of varying usefullness ).

>
> http://wiki.tcl.tk/1389 says:
>
> "cgilib.tcl from Brent Welch's BOOK Practical Programming in Tcl and Tk, Third
> edition. ncgi is descended from and largely supersedes cgilib."
>
> So my question to the TCL community remains:
>
> Anybody ever used "ncgi"? Any examples (guestbook, etc) code available for
> study? TIA...
> --
> duke nukem?


uwe

Neil Madden

2006-11-27, 7:05 pm

Merrilee Larson wrote:
> On 2006-11-27, Darren New <dnew@san.rr.com> wrote:
>
> I've done quite a bit of CGI stuff in Perl and PHP. I'm looking for a library
> or module that does *just* CGI parsing/decoding and of course the proper
> header. cgi.tcl and cgilib.tcl both include HTML parsing that I don't want to
> bloat my scripts with. I found the "ncgi" library in the ActiveTCL distro. I
> simply need an example application that uses "ncgi" for several reasons:
> 1. to learn TCL programming
> 2. to learn the TCL-way of doing CGI programming
> 3. to evaluate TCL to see if *I'm* compatible with it.


There does seem to be a lack of examples of ncgi available. However, the
main docs seem fairly clear:

"In the simplest case, a CGI script first calls ::ncgi::parse and then
calls ::ncgi::value to get different form values. If a CGI value is
repeated, you should use ::ncgi::valueList to get back the complete list
of values."

So, your example CGI script would look something like this (this one
just prints selected environment variables passed in as a query):

#!/usr/bin/env tclsh
package require ncgi
ncgi::parse
set pattern [ncgi::value vars "*"]
puts "Content-Type: text/plain\n"
puts "Environment Variables matching: $pattern"
parray ::env $pattern

Call that env.cgi in your cgi-bin and then call it as
..../env.cgi?vars=S* and you should see a list of all environment
variables that begin with "S".

-- Neil
Darren New

2006-11-27, 7:05 pm

Merrilee Larson wrote:
> Re: your first URL above, I'd say that 95% of the links are broken or obsolete.


It's the result of a search of the pages on the server on which the
search was run. Not a single listed link is broken. What are you talking
about?

> Re: the wiki.tcl search engine -- I searched for "ncgi" - a library included in
> the ActiveTCL distro. Nada! NADA!
>
> I Googled ncgi+TCL --> no joy!


No joy? The first hit that *isn't* google groups of this newsgroup is
http://tcllib.sourceforge.net/doc/ncgi.html
which is the TclLib documentation for ncgi.

ncgi is in TclLib. That's like saying "Check CPAN". It's not part of
activestate, but it's pure Tcl, so you just copy it into your
installation path and run with it. Download TclLib off sourceforge and
go for it. It has lots of useful stuff in it.

> Anybody ever used "ncgi"? Any examples (guestbook, etc) code available for
> study? TIA...


The third top-level hit in google for "tcl ncgi guestbook.cgi" yields
http://www.demailly.com/~dl/guest_book.tcl.txt
and
http://expect.nist.gov/cgi.tcl/


--
Darren New / San Diego, CA, USA (PST)
Scruffitarianism - Where T-shirt, jeans,
and a three-day beard are "Sunday Best."
Cameron Laird

2006-11-28, 7:11 pm

In article <20Nah.20462$Hp3.3537@clgrps13>,
Merrilee Larson <dnormandin@bsdrocksperlrolls.com> wrote:
Robert Hicks

2006-11-28, 7:11 pm


Bruce Hartweg wrote:
> Merrilee Larson wrote:
>
> I'm pretty sure ncgi is Dons Libraray, with maybe some namespaceing done to it.
> Bruce


I think that Tcl + jQuery is a pretty good combo in and of themselves.

Robert

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com