You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Dirk Melchers <me...@nureg.de> on 2001/04/18 10:48:15 UTC

Setting %fdat by script?

Hi,

I am trying to mix Mason and Embperl and have a problem with inserting
data into %fdat by the script.
I am not sure, if my problem (see below) is triggered by Mason or
Embperl.


My setup: Apache 1.2.13, mod_perl 1.24 not DSO, Embperl 1.3.1, Mason
1.0.


index.html is parsed by mason; mason puts a navigation around the
index.html:
-------------- index.html -----
<%init>
use HTML::Embperl;

my $out="";
HTML::Embperl::Execute({inputfile=>"/some/dir/formular.epl",fdat=>\%ARGS,output=>\$out});
</%init>
<% $out %>
-------------- end index.html ---------

So mason calls Embperl, executes formular.epl and returns the output.

In formular.epl I read a file and insert these data into %fdat for
further form processing.

So I do (pseudo code):

foreach $key (keys %filehash) {
	$fdat{$key}=$filehash{$key}
}

Then I have a form to proceed to the next step and pass %fdat via
[$hidden$]

The problem: my inserted data is not passed to the next page.

I tried to insert the following code inside the foreach loop:

$f=0;
foreach $i (0..$#ffld) {
	if($ffld[$i] eq "${bereich}_${key}") {
		$f=1;
	}
} 
if ($f == 0) {
	push @ffld, "${bereich}_${key}";
}

This helped, but sometimes the data in %fdat gets doubled, so all fields
are stored twice and Data::Dumper show only ARRAY(0x...), no more
values.


Long story, short question: What is the right way to insert data into
%fdat?


Tschuess,

Dirk Melchers.

-------------------------------------------------------------------------
Dirk Melchers             NUREG Neue Medien       Fon   +49 911
32002-256
melchers@nureg.de        Dorfäckerstrasse 31      Fax   +49 911
32002-299
http://www.nureg.de       D-90427 NĂĽrnberg        Mobil +49 172 935 46
70
-------------------------------------------------------------------------

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


Re: Setting %fdat by script?

Posted by Gerald Richter <ri...@ecos.de>.
>Hi,

>I am trying to mix Mason and Embperl

Just curious, why do mix these two instead of using only one of them ?


>In formular.epl I read a file and insert these data into %fdat for
>further form processing.
>
>So I do (pseudo code):
>
>foreach $key (keys %filehash) {
>$fdat{$key}=$filehash{$key}
>}

That's correct

>Then I have a form to proceed to the next step and pass %fdat via
>[$hidden$]
>
>The problem: my inserted data is not passed to the next page.

If you read the description for hidden carefully you see, that, if you don't
specify anything else, it takes only those elements out of %fdat, for which
exits in @ffld, so just add

@ffld = keys %fdat ;

after your loop

>Tschuess,

Ebenso

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



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