On Thu, 2004-01-08 at 15:43, Alexander Bergolth wrote:
> Why do I create a closure? If i'd create a closure I would have to store 
> a reference to an _anonymous sub

No, that's a common misconception.  Closures and anonymous subs are two
totally separate things, although they can be used together.  See the
explanation here:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#Understanding_Closures____the_Easy_Way

There is more discussion in the list archives.

> My version uses a regular (named-) sub and the scope of the variable $r 
> should be lexically local to the enclosing block.

And it is, but your sub creates a closure so that when $r changes in the
enclosing block that is not seen in your sub.  The simplest solution is
to pass $r every time.

> Moreover I've read that Apache->request should be avoided in mod_perl2:
> http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache_E_gt_request_

That only applies to threaded MPMs, and modules you release that others
might want to run under threaded MPMs.

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to