You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_dtcl@tcl.apache.org by yahalom emet <ya...@zvia.org.il> on 2001/12/06 14:02:17 UTC

Re: error script

Hi

how can I get the variables I defined in the page in the error script ?
with cgi.tcl I used:

     foreach a [info var] {
      if {[catch {set _var [set ${a}]}]} {
           puts $ofd "$a [array get $a]"
      } elseif {![regexp "tcl" $_var]} {
           puts $ofd "$a $_var" 
      }
     }


Thanks

Yahalom Emet
Software Developer
Xor Technologies Ltd.

Tel: +972 (0)4-6619164
E-mail: yahalom@zvia.org.il
Web: http://www.xortechnologies.com


----- Original Message ----- 
From: "David N. Welton" <da...@dedasys.com>
To: "yahalom emet" <ya...@zvia.org.il>
Cc: "Mod_dtcl" <mo...@tcl.apache.org>
Sent: Wednesday, November 28, 2001 12:42 PM
Subject: Re: error script


> "yahalom emet" <ya...@zvia.org.il> writes:
> 
> > I added an ErrorScript to apache.I want this script to mail the
> > admin the error info and all variables cookies and local varibale
> > that where used in the script.
> 
> Interesting - if/when you get it working, it would be a nice snippet
> of code to share with the group.
> 
> > 1. how do I get the error?
> 
> This would be a good thing to include in the docs, I suppose:-) The
> variable is "errorInfo", which in all fairness, is a documented part
> of Tcl, but I suppose it would be a good thing to reiterate it in my
> docs.
> 
> Example:
> 
> tclsh8.3 [~]catch { boogy woogy }
> 1
> tclsh8.3 [~]puts $errorInfo 
> invalid command name "boogy"
>     while executing
> "boogy woogy "
> 
> > 2. it seems that VARS and ENVS and COOKIES does not exist in the
> > error script. also local variable that where created in the script
> > are not retrieved by a similiar scriot I used with tcl.cgi:
> 
> You have to access them like this:
> 
> ::request::VARS
> 
> ::request::ENVS
> 
> and so on.  This is because pages (at least .ttml) are run in the
> 'request' namespace, in order to keep things clean.  Another thing to
> put in the docs... thanks for asking about this stuff:-)
> 
> -- 
> David N. Welton
>    Consulting: http://www.dedasys.com/
> Free Software: http://people.debian.org/~davidw/
>    Apache Tcl: http://tcl.apache.org/
>      Personal: http://www.efn.org/~davidw/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: mod_dtcl-unsubscribe@tcl.apache.org
> For additional commands, e-mail: mod_dtcl-help@tcl.apache.org


Re: error script

Posted by "David N. Welton" <da...@dedasys.com>.
"yahalom emet" <ya...@zvia.org.il> writes:

> I tried but with no help. all I get is the REQUEST,ENVS,VAR and USER
> (which I didn't know that existed).

> it is a shame if it cannot be done. it is crucial in debugging
> unexpected errors.

error.ttml:
<?
hgetvars 

set BLAH 1

boogy woogy
# cause error

?>

srm.conf:
Dtcl_Script ErrorScript "source /var/www/error.tcl"

error.tcl:
puts stderr [info vars ::request::*]

::request::ENVS ::request::BLAH

Ciao,
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: error script

Posted by yahalom emet <ya...@zvia.org.il>.
Hi

I tried but with no help. all I get is the REQUEST,ENVS,VAR and USER (which
I didn't know that existed).
it is a shame if it cannot be done. it is crucial in debugging unexpected
errors.


Thanks

Yahalom Emet
Software Developer
Xor Technologies Ltd.

Tel: +972 (0)4-6619164
E-mail: yahalom@zvia.org.il
Web: http://www.xortechnologies.com


----- Original Message -----
From: "David N. Welton" <da...@dedasys.com>
To: "yahalom emet" <ya...@zvia.org.il>
Cc: "Mod_dtcl" <mo...@tcl.apache.org>
Sent: Thursday, December 06, 2001 8:21 PM
Subject: Re: error script


> "yahalom emet" <ya...@zvia.org.il> writes:
>
> > how can I get the variables I defined in the page in the error
> > script ?  with cgi.tcl I used:
>
> >      foreach a [info var] {
> >       if {[catch {set _var [set ${a}]}]} {
> >            puts $ofd "$a [array get $a]"
> >       } elseif {![regexp "tcl" $_var]} {
> >            puts $ofd "$a $_var"
> >       }
> >      }
>
> Hrm... that's a tougher question...
>
> Have you tried:
>
> info vars ::request::*
>
> ?
>
> --
> David N. Welton
>    Consulting: http://www.dedasys.com/
> Free Software: http://people.debian.org/~davidw/
>    Apache Tcl: http://tcl.apache.org/
>      Personal: http://www.efn.org/~davidw/


Re: error script

Posted by "David N. Welton" <da...@dedasys.com>.
"yahalom emet" <ya...@zvia.org.il> writes:

> how can I get the variables I defined in the page in the error
> script ?  with cgi.tcl I used:
 
>      foreach a [info var] {
>       if {[catch {set _var [set ${a}]}]} {
>            puts $ofd "$a [array get $a]"
>       } elseif {![regexp "tcl" $_var]} {
>            puts $ofd "$a $_var" 
>       }
>      }

Hrm... that's a tougher question...

Have you tried:

info vars ::request::*

?

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/