On Fri, 2005-08-19 at 20:24 -0400, Christopher H. Laco wrote:
> I'm assuming that each tome dosomething() changes @contect, it's only 
> changing @contect for that MP child process.

Correct.  However, dosomething() is a closure in your code, so @context
will persist.

> Now, I need to have another module used in that same request, modify the 
> context of the first...
> 
> package MyMod;
> {
>    my @context;
>    sub dosomething {
>      push @context;
>      #...do other stuff..
>    };
>    sub pushcontext {
>      push @context, shift;
>    };
> };
> 1;
> 
> package MyMod2;
> {
>    my @context;
>    sub dosomething {
>      push @context;
>      #...do other stuff..
>      MyMod::poshcontext('foo');
>    };
> };
> 1;

Those are not referring to the same @context.

> Is that safe across requests?

Define safe...

> I'm assuming that MyMod is change MyMod2 
> in the same request/child process?

No, I don't think so.  They are two different variables named @context
in different scopes.

>  FOr that matter, what is the lifetime 
> of my @context in that situation?

Forever, since it's used in a closure.

- Perrin

Reply via email to