perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kee Hinckley <naz...@somewhere.com>
Subject Re: [$ sub $] return
Date Thu, 11 Sep 2003 14:46:44 GMT
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


Mime
View raw message