I've struggled with wanting to use globals too, but it's not the functional
way.  Our current approach is to create a parallel request object and pass
that through all of the function calls.  We set a member of the parallel
request object to the actual Apache request object.  Something like this:

$s->new Session($r, $dbh);

and then in Session,

sub new {
  ($class, $self->{REQUEST}, $self->{DBH})=...@_;

and then later

DoStuffWithRequest($s);

It might be neater to just override the Apache request object.




On Fri, Apr 23, 2010 at 2:20 PM, Tosh Cooey <t...@1200group.com> wrote:

> I'm drawing a blank here and I probably shouldn't be, but...
>
> I would like to use a global variable that's only available for the
> duration of a request.
>
> I guess I could create() and undef() the variable at the start and end of
> each request but that seems so... inelegant...
>
> Any suggestions?
>
> Danke!
>
> Tosh
>
> --
> McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
>

Reply via email to