Andrew;

Thanks for the suggestion. I had tried using Execute with the subreq option, but I had problems, which might be related to our using FastCGI.

I also had tried using Execute with the object option, which seemed ideal, but could not get it to work. Your pointer to the documentation gave me a clue as to why I could't get it to work. There is an optional parameter to the object option called syntax. The default syntax is HTML+Embperl. I needed to specify Perl as the syntax. This allows me to create an new App object from any _app.pl within my application tree:

 my $app2 = Execute({object => '<path>/_app.pl', syntax => 'Perl'});

Thanks and regards,

Doug Rayner
Senior System Architect
Savicom: Next Generation eMail Marketing
http://www.savicom.net
(415) 617-9006


----- Original Message ----- From: "Andrew O'Brien" <andr...@oriel.com.au>
To: "Doug Rayner" <dray...@savicom.net>; <embperl@perl.apache.org>
Sent: Thursday, April 02, 2009 3:19 PM
Subject: RE: Execute() and App objects



Hi Doug,

From within one request, I'm trying to Execute() an HTML
template from
another part of the application.  That template is dependent
on App object
methods defined in the _app.pl that is in the same directory
as the HTML
template.  However, the Execute() seems to use the Req and
App objects from
the calling context.  That App object does not have the
appropriate methods
defined, and I'd prefer not to have to copy them there, of
find some other
way to share them between the two App objects.

Does anyone have any ideas on how to make this Execute()
behave as what I
would call a 'first class request'?  In other words, get it
to load and use
the _app.pl that is associated with the target HTML template?

Haven't used it recently but the subrequest process is probably what
you're after:

http://perl.apache.org/embperl/pod/intro/IntroEmbperl2.-page-8-.htm

"When running Embperl with Apache 2.0 there are some extented
possibilities. While Apache 1.x has send all it's ouput directly to the
browser, Apache 2.0 introduces a concept of filters, which allows to
process the output of any Apache handler through a chain of filters.
Embperl can use this to embed any output that Apache can generate as a
Embperl::Object component, just like it is any native Embperl page. This
can be done by using the subreq parameter:

   [- Execute ({subreq=>'/cgi-bin/script.cgi'}) -]

The above code includes the output of a cgi script into a page."

Cheers,

Andrew


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

Reply via email to