On Wed, 24 May 2000, Marc Lehmann wrote:
> I was under the impression that you cannot configure Apache from a
> PerlRequire. If that is not the case (and somehow works) I'd really like
> to get away from perlsections.
You can only configure Apache from <Perl> sections, but you can load all
your modules, shared data, etc. from a file pulled in with PerlRequire.
> > Your sub &x is a closure. That's why it returns the previous value of
> > $x. When it gets re-defined, it should start looking at the value of the
> > new $x.
>
> You cannot redefine closures as well.
Closures are a confusing aspect of perl, and I could easily be mistaken
about them, but Randal and Doug seem to agree that this is a closure:
my $x;
sub show_x {
print $x;
}
The easiest definition I've found is the one that Damian Conway has in his
OO Perl book:
"In Perl, a closure is just a subroutine that refers to one or more
lexical variables declared outside the subroutine itself."
When this code gets parsed, the $x goes out of scope at the end of the
block, but &show_x keeps a copy of it.
I think that this is the source of the behavior you saw where it looked
like there were multiple versions of subs and variables being created.
Anyway, I was just trying to help you solve your problem. There's no need
to get defensive.
- Perrin