On Sat, 2005-08-20 at 08:28 -0400, Christopher H. Laco wrote:
> Huh? Now I'm really confused. MyMod2 calls MyMod1::dosomething alters 
> it's own @context (it should've been push @context, 'foo')...
> 
> MyMod2 calls MyMod1::pushcontext('anotherfoo') to also alter MyMod1s 
> @context.

I've lost track of your example.  If you want feedback on specific code,
please post a working example and I'll look at it.

> Why would each modules @context persist since they're declare 
> as my and their our of closure?

That's what closures do.  Here's a classic example:

my $cgi = CGI->new();
my $color = $cgi->param('color');

sub print_color {
    print $color;
}

This sub will always print whatever $color was the first time the script
was run.  It is a closure, and keeps a private copy of $color.

> Even if they did, that's a moot point as I can resent them during every 
> page request (via AxKits start_document function).

You can't unless you create another closure with access to the same
variable.  These are not globals -- setting $color here later will not
change the $color that print_color() is looking at.

> What I'm more worried about is that I just want those MyMod1 and MyMod2 
> @context changes to be effecting the current request only, not other 
> requests in other apache child processes.

It's impossible for them to affect other child processes.  Processes are
totally separated from each other and run their own perl interpreters.

- Perrin

Reply via email to