You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Marek Matis <ma...@gmail.com> on 2006/08/18 11:53:26 UTC

Embperl2 and Execute

Hi,
I have problem with Execute (EmbPerl2.0r3).

[-
@tmp = (1 .. 3);

foreach $r (@tmp) {

$fdat{'test_'.$r} = $r;
$out = "<input type='text' name='test_$r' />\n";
Execute ({ input => \$out });
}
-]


Output is:

<input type='text' name='test_1' / value="1">
<input type='text' name='test_1' / value="1">
<input type='text' name='test_1' / value="1">


I need this:

<input type='text' name='test_1' / value="1">
<input type='text' name='test_2' / value="2">
<input type='text' name='test_3' / value="3">



Thanks
Marek

RE: Embperl2 and Execute

Posted by Gerald Richter <ri...@ecos.de>.
> > This not work too.
> >
> > [-
> >    @tmp = (1 .. 3);
> >
> >    foreach $r (@tmp) {
> >       $fdat{'test_'.$r} = $r;
> >       $out = "<input type='text' name='test_$r' />\n";
> >       Execute ({ input => \$out, inputfile => 'foo', mtime=> $r});
> >    }
> > -]
> >

You are right, for performance reasons Embperl does not check for mtime
changes within one request. You could work around this with


    Execute ({ input => \$out, inputfile => "foo$r"});

Gerald



 
** Virus checked by BB-5000 Mailfilter ** 


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


Re: Embperl2 and Execute

Posted by Marek Matis <ma...@gmail.com>.
I tried to do it in new version EmbPerl 2.2.0 but is doestnt work.

Matis.


2.2.0
2006/8/21, Marek Matis <ma...@gmail.com>:
> This not work too.
>
> [-
>    @tmp = (1 .. 3);
>
>    foreach $r (@tmp) {
>       $fdat{'test_'.$r} = $r;
>       $out = "<input type='text' name='test_$r' />\n";
>       Execute ({ input => \$out, inputfile => 'foo', mtime=> $r});
>    }
> -]
>
>
> Marek
>
>
> 2006/8/18, Ben K. <bk...@coe.tamu.edu>:
> > > This is only demo example.
> > > I need uses Execute in loo than how Embperl 1.3.
> >
> > I show the same symptom...
> > If situations allow will this be a workaround?
> >
> > [-
> >    @tmp = (1 .. 3);
> >    foreach $r (@tmp) {
> >      $fdat{'test_'.$r} = $r;
> >      $out .= "<input type='text' name='test_$r' />\n";
> >    }
> >
> >    Execute ({ input => \$out });
> >
> > -]
> >
> >
> > Regards,
> >
> > Ben K.
> > Developer
> > http://benix.tamu.edu
> >
>

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


Re: Embperl2 and Execute

Posted by Marek Matis <ma...@gmail.com>.
This not work too.

[-
   @tmp = (1 .. 3);

   foreach $r (@tmp) {
      $fdat{'test_'.$r} = $r;
      $out = "<input type='text' name='test_$r' />\n";
      Execute ({ input => \$out, inputfile => 'foo', mtime=> $r});
   }
-]


Marek


2006/8/18, Ben K. <bk...@coe.tamu.edu>:
> > This is only demo example.
> > I need uses Execute in loo than how Embperl 1.3.
>
> I show the same symptom...
> If situations allow will this be a workaround?
>
> [-
>    @tmp = (1 .. 3);
>    foreach $r (@tmp) {
>      $fdat{'test_'.$r} = $r;
>      $out .= "<input type='text' name='test_$r' />\n";
>    }
>
>    Execute ({ input => \$out });
>
> -]
>
>
> Regards,
>
> Ben K.
> Developer
> http://benix.tamu.edu
>

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


Re: Embperl2 and Execute

Posted by "Ben K." <bk...@coe.tamu.edu>.
> This is only demo example.
> I need uses Execute in loo than how Embperl 1.3.

I show the same symptom...
If situations allow will this be a workaround?

[-
   @tmp = (1 .. 3);
   foreach $r (@tmp) {
     $fdat{'test_'.$r} = $r;
     $out .= "<input type='text' name='test_$r' />\n";
   }

   Execute ({ input => \$out });

-]


Regards,

Ben K.
Developer
http://benix.tamu.edu

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


Re: Embperl2 and Execute

Posted by Marek Matis <ma...@gmail.com>.
This is only demo example.
I need uses Execute in loo than how Embperl 1.3.


2006/8/18, Michael Smith <sm...@gmail.com>:
>
> Hi Marek,
>
> I'd suggest something a bit more like this (it's untested but hopefully
> you get the idea):
>
> [- @tmp=(1..3) -]
> [$ foreach $r (@tmp) $]
> <input type='text' name='test_[+ $r +]' / value="[+ $r +]">
> [$ endforeach $]
>
> Hope this helps - obviosuly TMTOWTDI, but I try to avoid putting HTML in
> the perl sections.
>
> Michael
>
>
>
> On 8/18/06, Marek Matis <ma...@gmail.com> wrote:
> >
> > Hi,
> > I have problem with Execute (EmbPerl2.0r3).
> >
> > [-
> > @tmp = (1 .. 3);
> >
> > foreach $r (@tmp) {
> >
> > $fdat{'test_'.$r} = $r;
> > $out = "<input type='text' name='test_$r' />\n";
> > Execute ({ input => \$out });
> > }
> > -]
> >
> >
> > Output is:
> >
> > <input type='text' name='test_1' / value="1">
> > <input type='text' name='test_1' / value="1">
> > <input type='text' name='test_1' / value="1">
> >
> >
> > I need this:
> >
> > <input type='text' name='test_1' / value="1">
> > <input type='text' name='test_2' / value="2">
> > <input type='text' name='test_3' / value="3">
> >
> >
> >
> > Thanks
> > Marek
> >
> >
> >
> >
>

Re: Embperl2 and Execute

Posted by Michael Smith <sm...@gmail.com>.
Hi Marek,

I'd suggest something a bit more like this (it's untested but hopefully you
get the idea):

[- @tmp=(1..3) -]
[$ foreach $r (@tmp) $]
<input type='text' name='test_[+ $r +]' / value="[+ $r +]">
[$ endforeach $]

Hope this helps - obviosuly TMTOWTDI, but I try to avoid putting HTML in the
perl sections.

Michael


On 8/18/06, Marek Matis <ma...@gmail.com> wrote:
>
> Hi,
> I have problem with Execute (EmbPerl2.0r3).
>
> [-
> @tmp = (1 .. 3);
>
> foreach $r (@tmp) {
>
> $fdat{'test_'.$r} = $r;
> $out = "<input type='text' name='test_$r' />\n";
> Execute ({ input => \$out });
> }
> -]
>
>
> Output is:
>
> <input type='text' name='test_1' / value="1">
> <input type='text' name='test_1' / value="1">
> <input type='text' name='test_1' / value="1">
>
>
> I need this:
>
> <input type='text' name='test_1' / value="1">
> <input type='text' name='test_2' / value="2">
> <input type='text' name='test_3' / value="3">
>
>
>
> Thanks
> Marek
>
>
>
>

RE: Embperl2 and Execute

Posted by Gerald Richter <ri...@ecos.de>.
> 
> Not work. Embperl always cache the input code. 
> 

Mmmh, if you use

 mtime => $dummy++

So mtime change everytime?

Gerald


> 
> 
> 2006/8/18, Gerald Richter <ri...@ecos.de>:
> 
> 	>
> 	> [-
> 	> @tmp = (1 .. 3);
> 	>
> 	> foreach $r (@tmp) {
> 	>
> 	> $fdat{'test_'.$r} = $r;
> 	> $out = "<input type='text' name='test_$r' />\n"; Execute ({
> 	> input => \$out }); } -] 
> 	>
> 	
> 	Try
> 	
> 	$out = "<input type='text' name='test_$r' />\n"; Execute ({
> 	input => \$out, inputfile => 'foo', mtime => undef }); } -]
> 	
> 	This should tell Embperl not to cache the input code, 
> i.e. to recompile it
> 	everytime, because it has changed. You can optimzie 
> this by passing always
> 	the same value for inputfile, if you have the same code 
> for input and no
> 	mtime.
> 	
> 	Gerald
> 	
> 	
> 	
> 	>
> 	> Output is:
> 	>
> 	> <input type='text' name='test_1' / value="1">
> 	> <input type='text' name='test_1' / value="1">
> 	> <input type='text' name='test_1' / value="1"> 
> 	>
> 	>
> 	> I need this:
> 	>
> 	> <input type='text' name='test_1' / value="1">
> 	> <input type='text' name='test_2' / value="2">
> 	> <input type='text' name='test_3' / value="3"> 
> 	>
> 	>
> 	>
> 	> Thanks
> 	> Marek
> 	>
> 	>
> 	>
> 	>
> 	>
> 	
> 	
> 	
> 	** Virus checked by BB-5000 Mailfilter **
> 	
> 	
> 
> 
> 


 
** Virus checked by BB-5000 Mailfilter ** 


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


Re: Embperl2 and Execute

Posted by Marek Matis <ma...@gmail.com>.
 Not work. Embperl always cache the input code.


2006/8/18, Gerald Richter <ri...@ecos.de>:
>
> >
> > [-
> > @tmp = (1 .. 3);
> >
> > foreach $r (@tmp) {
> >
> > $fdat{'test_'.$r} = $r;
> > $out = "<input type='text' name='test_$r' />\n"; Execute ({
> > input => \$out }); } -]
> >
>
> Try
>
> $out = "<input type='text' name='test_$r' />\n"; Execute ({
> input => \$out, inputfile => 'foo', mtime => undef }); } -]
>
> This should tell Embperl not to cache the input code, i.e. to recompile it
> everytime, because it has changed. You can optimzie this by passing always
> the same value for inputfile, if you have the same code for input and no
> mtime.
>
> Gerald
>
>
>
> >
> > Output is:
> >
> > <input type='text' name='test_1' / value="1">
> > <input type='text' name='test_1' / value="1">
> > <input type='text' name='test_1' / value="1">
> >
> >
> > I need this:
> >
> > <input type='text' name='test_1' / value="1">
> > <input type='text' name='test_2' / value="2">
> > <input type='text' name='test_3' / value="3">
> >
> >
> >
> > Thanks
> > Marek
> >
> >
> >
> >
> >
>
>
>
> ** Virus checked by BB-5000 Mailfilter **
>
>

RE: Embperl2 and Execute

Posted by Gerald Richter <ri...@ecos.de>.
> 
> [-
> @tmp = (1 .. 3);
> 
> foreach $r (@tmp) {
> 
> $fdat{'test_'.$r} = $r;
> $out = "<input type='text' name='test_$r' />\n"; Execute ({ 
> input => \$out }); } -]
> 

Try

$out = "<input type='text' name='test_$r' />\n"; Execute ({ 
input => \$out, inputfile => 'foo', mtime => undef }); } -]

This should tell Embperl not to cache the input code, i.e. to recompile it
everytime, because it has changed. You can optimzie this by passing always
the same value for inputfile, if you have the same code for input and no
mtime. 

Gerald



> 
> Output is:  
> 
> <input type='text' name='test_1' / value="1">
> <input type='text' name='test_1' / value="1"> 
> <input type='text' name='test_1' / value="1">
> 
> 
> I need this:  
> 
> <input type='text' name='test_1' / value="1">
> <input type='text' name='test_2' / value="2"> 
> <input type='text' name='test_3' / value="3">
> 
> 
> 
> Thanks 
> Marek 
>   
> 
> 
> 
> 


 
** Virus checked by BB-5000 Mailfilter ** 


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