perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luiz Fernando B. Ribeiro" <l...@engenhosolucoes.com.br>
Subject Re: Difference between %udat and %sdat?
Date Mon, 17 May 2004 16:15:27 GMT
On Mon, 17 May 2004 08:04:01 -0700, Doug Rayner <drayner@savicom.net>  
wrote:

> I would like to share state between the application object and code on
> individual template pages for the duration of a request. I'm not sure  
> what
> the best way to do this is.
>
> I considered using %udat, but this causes an unnecessary storing of the
> session object at the end of the request.  I see there is a another  
> "state"
> object (%sdat), but I'm not sure what the intended use of this is, or how
> %sdat differs from %udat.
>
> I don't see any properties on the application object itself that seem
> intended for this purpose.  Is the application object a hahs reference?
> Could one add new hash keys to it if one desired?
>
> Any suggestions welcomed...

Use the Apache request object that is passed to all Executed pages as the
first argument in @_.

Example:

template.epr
[-
$req = shift;

$req->{var1} = 'ok';
$req->{my_object} = new Object;
-]

in other pages in the same request:
[-
$req = shift;

do_something() if $req->{var1};
$req->{my_object}->method();
-]

-- 
Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet
+55 11 4485-0136

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message