You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by allen haim <al...@netherrealm.net> on 2005/04/22 00:42:39 UTC

Embperl & CGI

Thanks Andrew; that's perfect.

Another question: can I call an ordinary CGI script from within an embperl
page, and send it the parameters it needs? Of course, I can 'require' it
from within [- -] tags, but then the CGI parameters won't work right.

Allen

On Thu, Apr 21, 2005 at 09:47:30AM +1000, Andrew O'Brien wrote:
> 
> Allen,
> 
> That's all up to how you structure your page construction. You will need
> to either
> 
> 1. Easier: be able to test for that branch condition early enough in
> your page
>    construction and then have the two Execute()s in a wrapping "if"
> statement
> Or
> 2. take advantage of the fact that Execute can put its output into a
> scalar and
>    you can pass back information either via scalar reference parameters
> or via
>    the errors option to Execute. Contrived example:
> 
> page.epl:
> ...
> [-
>   $req = shift;
>   my $do_something_else = 0;
>   $out = '';
>   Execute({inputfile => 'page_that_can_return_errors.epl',
>            output => \$out,
>            param => [\$do_something_else]
>           });
>   if ( $do_something_else ) {
>     Execute( 'alternative_content.epl' );
>   } else {
>     local $escmode=0;
>     print OUT $out;
>   }
> -]
> 
> Page_that_can_return_errors.epl:
> [-
>   $req = shift;
>   $test = shift @param;
>   if ($something_went_wrong) {
>     $$test = 1;
>     exit;
>   }
> -]
> 
> -- 
> Andrew O'Brien
> Development Manager
> e: andrewo@oriel.com.au    p: +61 2 9461 0114
> w: www.oriel.com.au        f: +61 2 9431 6700 
> 
> > -----Original Message-----
> > From: allen haim [mailto:allen@netherrealm.net] 
> > Sent: Thursday, 21 April 2005 7:00 AM
> > To: embperl@perl.apache.org
> > Subject: Execute question
> > 
> > Hi,
> > 
> > How do I abort the flow of my current Embperl page and bring 
> > up a different
> > Embperl page?
> > 
> > If I use Execute, it puts the other page inside the calling 
> > page, but I
> > would like to discard the calling page entirely and just 
> > bring up the new
> > page.
> > 
> > Do I use Execute for this or something else?
> > 
> > Thanks,
> > 
> > Allen
> > 
> > 
> > -- 
> > happy random george orwell advice for making tea:
> > 
> > 	Some people would answer that they don't like tea in 
> > itself, that they only drink it in order to be warmed and 
> > stimulated, and they need sugar to take the taste away.
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> > For additional commands, e-mail: embperl-help@perl.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 

-- 
happy random excerpt from the Weblog of J. Alfred Prufrock:

Saturday, April 10, 2004

so ended up at fresh choice, which was SO good (want more bacon bits, vivienne? LOL!) and it was pretty cool until valerie totally took forever in the bathroom and we were all waiting to go but she said she was just preparing her face to meet the faces that she'd meet and we were like, ok. ezra seemed kind of mad at that, but i told we still had time to go to express, to murder and create, time for all the works and days of hands, and time to go to sam goody afterward to get a cd for ezra's dad's birthday. so we ate some more toast and tea and then shopped for like two more hours and my feet were tired but it was cool.

� 1:10 AM

http://jalfredprufrock.blogspot.com

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


RE: Embperl & CGI

Posted by Gerald Richter <ri...@ecos.de>.
> 
> Another question: can I call an ordinary CGI script from 
> within an embperl page, and send it the parameters it needs? 
> Of course, I can 'require' it from within [- -] tags, but 
> then the CGI parameters won't work right.
> 

If you use Apache 2, you can include a the CGI as subrequest by issueing
something like the following:

Execute ({subreq => '/cgi-bin/script.cgi?parm=1&parm2=2'}) ;


Gerald




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