Re: Weird variable scope problem

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC0_be1VD7tU1M1DAo53Cgz0PcCYS2uu3fc-1cR_EoJMKr0xFQ@mail.gmail.com>
On Fri, Mar 25, 2016 at 10:11 AM, John Dunlap <[email protected]> wrote:
>
> Basically, I have a module which has a some lexically scoped variables in
> it. These variables are used by accessor methods in the package. The
> problem is that, if I use this module in certain parts of my application,
> these variables are mysteriously empty even though I am certain that I've
> already initialized them.
>

How do you initialize them? In code that runs at compile-time in the same
module? In calls from httpd.conf or startup.pl? Is this an OO module with a
declared package name?


> Is there a way for a single perl interpreter to have multiple copies of a
> lexical variable?
>

No, but keep in mind that mod_perl is running inside multiple httpd
processes and each one has a separate interpreter with unique copies of all
lexicals.

- Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.