perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <ckas...@eplsite.org>
Subject Re: sharing data across SSI's (Executes)
Date Tue, 02 Sep 2003 20:11:51 GMT
Hi:

>
> Thanks for the advice.  Is there a preference to using
> $req->{test} versus $udat{test} ?

For global variables the natural way to do it in embperl is as Luiz
Fernando told you,see below this mail.
you can use this method to refference subs wiht variables too.

[- $req = shit; -]
[-
	$req->{mysub} =
	sub
	{
		print OUT "hello";
	}
-]

and you would call your sub in other page like this :

[- $req = shift; -]

[- $req->{mysub}(); -]


$udat is for handling sessions with apache, see this page:

http://perl.apache.org/embperl/pod/doc/Embperl.-page-5-.htm#sect_12



>
> thanks,
> Brian
>
> Luiz Fernando wrote:
>
>> On Thu, 2003-08-28 at 15:17, Brian Burke wrote:
>> > I have an Embperl question that hopefully someone can
>> > help me solve.  Bear with me, I'll try to illustrate the
>> > problem.
>> >
>> > I run apache mod_perl with Embperl 1.3.4.  I realize
>> > this is the old version, but I don't have the time, resources, or
>> > access level to do something about this.  I have code
>> > in which I implement server side includes in embperl
>> > documents using Execute.  example -
>> >
>> > [- $test = true; -]
>> > <html>
>> > <!-- this is index.html -->
>> > [- Execute ('form.inc') -]
>> > </html>
>> >
>> > where form.inc contains html to include for rendering a form.
>> >
>> > My question is, is there a way with Embperl 1.3.4 to
>> > share a perl variable (have the Executed page inherit
>> > the value)?  For example, in the simple index.html
>> > example, above, is there a way for me to access the value
>> > of $test from within form.inc?  Is there a different way to
>> > accomplish this?
>> >
>>
>> Use the req_rec object from mod_perl that is passed to all Executed
>> pages as the first argument in @_.
>>
>> [-
>> $req = shift;
>> $req->{test} = 'true';
>> -]
>> <html>
>> <!-- this is index.html -->
>> [- Execute ('form.inc') -]
>> </html>
>>
>> in form.inc do the same:
>> [-
>> $req = shift;
>> if ($req->{test} eq 'true') {
>>   ...
>> }
>> else {
>>   ...
>> }
>> -]
>>
>> --
>> Luiz Fernando Ribeiro
>> Engenho Soluções S/C Ltda
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
>> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org



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


Mime
View raw message