tcl-websh-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronnie Brunner <>
Subject Re: why? (Websh vs. PHP)
Date Fri, 02 Apr 2004 13:19:34 GMT
> Understanding the error is not so user-friendly: if i make some errs and
> try to load the page I get only a 500, and then I have to look for the
> error in the apache's error_log.

Well this is actually a security issue: you don't want to give the
user any hint about what went wrong, when something did go wrong. 

But what you can do during development:

if {[catch {

  # all your code goes here

} msg]} {

  web::put "<html><body><h1>Oops</h1>"
  web::put "Something went wrong:"
  web::put "<pre>[web::htmlify $msg]</pre>"
  if {[info exists errorInfo]} {
      web::put "additional info:"
      web::put "<pre>[web::htmlify $errorInfo]</pre>"


That will give you the answer in your browser.

> I'm not a experienced programmer, so I was bored by the overwhelming
> complexity I just discovered reading how to work with sessions (still
> havent found if a filesession remains across pages (not just
> web::commands), and how to check if a session is set)

The problem is that session handling is quite a complex thing if you
want to have a flexible framework. I have to admit that the current
solution in Websh is not trivial. (We preferred to be very flexible,
that's why the approach is a bit more complicated.)

Tracking sessions across pages is exactly the same as across
commands. Unsless you use a cookie session, you must create links to
your other pages that include the session id in the query string
Using web::dispatch you have to get this session id from the query
string (even if you don't hve any commands you want to dispatch to:
e.g [web::dispatch -cmd ""] will set up all parameters and form
fields for use with [web::param] and [web::formvar]).
If you don't want to create dynamic links, you must use cookies, (see
cookiecontext) otherwise you cannot track sessions across different
pages (applications).

For more specific answers I would need more specific questions I 
guess... Still hope that helps

> ps. First thing I did was this proc: 
> proc print {string} {
>    web::put "$string\n"
> }
> the word "web::put" is so uncomfortable ;-)

Well, it's TEA compliant: all procs and commands are in the web::
namespace (web::p would not really make a difference, would it ...)
I sometimes do that as well:
proc p s {web::put $s}
proc x c {web::putx $c}

Ronnie Brunner                   
Netcetera AG, 8040 Zuerich   phone +41 1 247 79 79 fax +41 1 247 70 75

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message