You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jaak <va...@hot.ee> on 2003/09/10 09:47:02 UTC
[$ sub $] return
Hi.
I'm using Embperl [$ sub $] feature.
Is it possible to return "all" data?
eg.
modules.epl
---
[$ sub hello $]
[- ($self, $hello) = @_; -]
Hello <b>[+ $hello . '...' +]!</b>
[$ endsub $]
---
test.html
---
[-
$subs = Execute ({'object' => "modules.epl"});
die $subs->hello('world');
-]
It returns: "world...",
but how to return "Hello <b>world...!</b>"
TIA.
btw. Embperl rocks :)
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: [$ sub $] return
Posted by Kee Hinckley <na...@somewhere.com>.
At 10:05 PM +1000 9/10/03, Angus Lees wrote:
>[$sub$]'s don't have useful return values. you have to do something
>like:
>
>[-
> my $output;
> Execute({inputfile => 'modules.epl', sub => 'hello',
> output => \$output});
> die $output;
>-]
The way I simulate return values in subs is to stuff a value in the
$_[0] hashref and let the parent access that. So, for instance, I
have a parent file that, when loaded, presents the user with a form,
validates the result, and then displays the next form, validates
that.... Typical order form or survey kind of thing. Each html file
I load has a form subroutine and a validate subroutine, and I call
each of them. First I call the validate routine, and it returns,
telling me whether or not sufficient data is there and whether I need
to display the form. Then I call the next validate, and so on until
the process is complete. (If you want me to explain that a bit
better just ask--I'm not at my most coherent this morning.)
--
Kee Hinckley
http://www.messagefire.com/ Anti-Spam Service for Companies and Individuals
http://commons.somewhere.com/buzz/ Writings on Technology and Society
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: [$ sub $] return
Posted by Angus Lees <gu...@inodes.org>.
At Wed, 10 Sep 2003 10:47:02 +0300, Jaak wrote:
> I'm using Embperl [$ sub $] feature.
> Is it possible to return "all" data?
>
> modules.epl
> ---
> [$ sub hello $]
> [- ($self, $hello) = @_; -]
> Hello <b>[+ $hello . '...' +]!</b>
> [$ endsub $]
> ---
>
> test.html
> ---
> [-
> $subs = Execute ({'object' => "modules.epl"});
> die $subs->hello('world');
> -]
>
> It returns: "world...",
> but how to return "Hello <b>world...!</b>"
[$sub$]'s don't have useful return values. you have to do something
like:
[-
my $output;
Execute({inputfile => 'modules.epl', sub => 'hello',
output => \$output});
die $output;
-]
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: [$ sub $] return
Posted by Jaak <va...@hot.ee>.
On Wed, 2003-09-10 at 14:31, Luiz Fernando wrote:
> Anywhere you call $subs->hello() will output the all the "output" of the
> sub hello.
>
> It should be working as you expected. What version of Embperl you are
> using? And what exactly you mean by:
> It returns: "world..."
>
Using Embperl 2.0b9 from CVS.
It won't return all data from sub. Only returning data between [+ & +]
I'll try using something like Gus suggested.
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: [$ sub $] return
Posted by Luiz Fernando <lu...@engenhosolucoes.com.br>.
On Wed, 2003-09-10 at 04:47, Jaak wrote:
> I'm using Embperl [$ sub $] feature.
> Is it possible to return "all" data?
>
> eg.
>
> modules.epl
> ---
> [$ sub hello $]
> [- ($self, $hello) = @_; -]
> Hello <b>[+ $hello . '...' +]!</b>
> [$ endsub $]
> ---
>
> test.html
> ---
> [-
> $subs = Execute ({'object' => "modules.epl"});
> die $subs->hello('world');
> -]
Anywhere you call $subs->hello() will output the all the "output" of the
sub hello.
It should be working as you expected. What version of Embperl you are
using? And what exactly you mean by:
It returns: "world..."
Regards,
--
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