----- Original Message -----
From: "Joshua Chamas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, April 21, 2001 3:54 AM
Subject: Re: modperl/ASP and MVC design pattern


> [EMAIL PROTECTED] wrote:
> >
> > To avoid passing many parameters to the subs I become using a $cx (cx
stand for
> > context) global hash containig everything the subs needed, passed to
each sub.
> >
> >    page test.asp
> >    $cx = {};
> >    $cx->{'name'} = 'default name';
> >    $cx->{'age'} = 30;
> >    ...
>
> Try this,
>
> # in global.asa
> use vars qw($cx); # set up $cx for global use
> sub Script_OnStart {
> $cx = {}; # initialize per request
> }
>
> # in script
> sub HelloWorld {
>   $cx->{name} = 'hello';
> }
>
> This will work, but I'd recommend you move your subs to
> global.asa, which is your central module for your scripts.

I' m using UniquePackages  and because subs name conflict I need to put the
subs in the asp pages.
Can I still use initialization of global vars in the
global.asa/Spript_OnStart (as you suggest) ?
...so the ASP/$Server->Transfer() is the equivalent of JSP/forward

Thanks
Francesco

>
> And then you can use $Server->Transfer() to change
> the file executing midstream.
>
> --Josh
>

Reply via email to