On Mon, Mar 27, 2006 at 08:52:03PM +0200, Gerald Richter wrote:
> > At
> >
> > http://www.ecos.de/embperl/pod/doc/Config.-page-1-.htm#sect_3
> >
> > I find the following example of how to invoke the Embperl
> > parser from a Perl program, and indeed I can make this work
> > in a simple script, like
> >
> > [- $msg = 'hello world' -]
> > <h3>[- Embperl::Execute({input=>\$msg}) -]</h3>
>
> You always need to specify the inputfile parameter (it doesn't matter with
> what value). Embperl used it as a cache key for the source code, so if you
> have different source code, you should use a different string as key to
> inputfile.
I now tried various definitions, such as
sub say {
local $msg = shift;
Embperl::Execute({input=>\$msg, inputfile=>$msg});
}
or
$n = 0;
sub say {
local $msg = shift;
Embperl::Execute({input=>\$msg, inputfile=>++$n});
}
use My::Lib qw(hello) ;
<h3>[- say('hello world') -]</h3>
<h3>[- say('hallo welt') -]</h3>
EOF
and am still getting always the same string printed out.
> See the examples on the web page you refering to.
I can't find any discussion on the use of inputfile as a cache key.
Also this usage scares me a bit, because 'inputfile' here seems to
be competing with 'input'. How do I know Execute reads its
input from the variable pointer and not from a file with the
name specified in 'inputfile', which might exist.
Also, a most elegant solution for my purpose might be to
avoid Embperl::Execute altogether and just use 'print' or 'printf'
to send my message to the web interface. After all the output=>
parameter also seems to default to STDOUT, so why not just print
to STDOUT ? But when I attempt to do so, nothing shows up on the
web page. Is there some other output stream to which I should possibly
be printing ?
--
Hartmut Pilch http://a2e.de/phm/adv/embperl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]