You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Karl Lehenbauer <ka...@flightaware.com> on 2011/02/10 07:34:01 UTC
note about package require from inside of a webpage in rivet
An experience user got burned by doing a package require inside a webpage and then later the httpd processes would malfunction because the procs got loaded into the request namespace and disappeared with it. It can be extra confusion because sometimes the pages work and sometimes they don't, depending on which child gets the request.
That's how it works, and I don't see an easy way to change it. I think we should document it as a common pitfall, however.
We (flightaware) load all of our packages up front, in the global init script, and now, instead, the server init script.
Also, a ... namespace eval :: {package require foo} ... should work. As we sort of replace global, perhaps we should replace package with a frontend. That seems pretty scary, though. Maybe best just to document the behavior and move on.
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org
Re: note about package require from inside of a webpage in rivet
Posted by Massimo Manghi <ma...@unipr.it>.
Stuff has begun to pile up. I'm going to put it in a TODO list on the
wiki before documenting it in the manual.
I think a new introductory section is needed. It could be titled
something like "Understanding Rivet Request Processing" and it should
explain the whole business. In fact it's not just a matter of writing a
caveat about the ::request namespace. Child init and exit scripts don't
run in the ::request namespace, and so do the AfterScript and
BeforeScript, but also a Tcl script referenced through an explicit URL
runs within global namespace, so there's more to say about it and it
could be merged with the task of properly documenting how the new
abort_page exception handling will work.
I can take it up, but I need time, not very long, but still some time to
do it
-- Massimo
On 02/10/2011 07:34 AM, Karl Lehenbauer wrote:
> An experience user got burned by doing a package
> require inside a webpage and then later the httpd processes
> would malfunction because the procs got loaded into the
> request namespace and disappeared with it. It can be extra
> confusion because sometimes the pages work and sometimes they
> don't, depending on which child gets the request.
>
> That's how it works, and I don't see an easy way to change it.
> I think we should document it as a common pitfall, however.
>
> We (flightaware) load all of our packages up front,
> in the global init script, and now, instead, the server init script.
>
> Also, a ... namespace eval :: {package require foo} ... should work.
> As we sort of replace global, perhaps we should replace package
> with a frontend. That seems pretty scary, though. Maybe best
> just to document the behavior and move on.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: rivet-dev-help@tcl.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org