Hello,

I'm running Embperl 2.2.0, mod_perl 2.0.2 under Apache 2.2.3.  I have successfully setup Embperl 2 for templating my website (templates display properly for .html files).  What I am trying to do now is convert some PERL scripts I have to make use of the Embperl templating features with only minor modifications ($r->print to Embperl::Object::Execute...).

Here is a test script before conversion:

my $r = shift;
subTest(\$r);
sub subTest {
        my $r = shift;
        my ($content,$cgienvvar);
        $content = "<HTML><BODY>";
        $content .= "<H1> Test </H1>\n";
        $content .= "</BODY></HTML>";
        $$r->content_type("text/html");
        $$r->print("$content");
        return Apache2::Const::OK;
} # end subTest

Result: Displays as expected.

Here is the same script after I converted to work with Embperl:

use Embperl;
use Embperl::Object;
my $r = shift;
subTest(\$r);
sub subTest {
        my $r = shift;
        my ($content,$cgienvvar);
        $content = "<H1> Test </H1>\n";
        Embperl::Object::Execute({
                input => \$content,
                mtime => 1,
                req_rec => $$r
        });
} # end subTest

Result: Displays the HTML properly but the Embperl template is not used.

And here are the Apache conf pieces relevant for Embperl:

    AddType text/html .epl
    EMBPERL_APPNAME testapp
    EMBPERL_DEBUG 0x7fffffff
    EMBPERL_ESCMODE 0
    EMBPERL_OPTIONS 16
    EMBPERL_OBJECT_BASE _base.epl
    PerlModule Embperl

    <FilesMatch "\.htm.?|\.epl$">
        SetHandler perl-script
        PerlHandler Embperl::Object
    </FilesMatch>

        ScriptAlias /cgi-bin/ /data/apache/htdocs/testsite/cgi-bin/
        <Directory "/data/apache/htdocs/testsite/cgi-bin/">
        <FilesMatch "\.pl$">
                EMBPERL_APPNAME test
                SetHandler perl-script
                PerlResponseHandler ModPerl::Registry
        </FilesMatch>
                SSLRequireSSL
                SSLOptions +StdEnvVars
                AllowOverride None
                Options None +ExecCGI
                Order allow,deny
                Allow from all
        </Directory>

When *.html files are processed I can see Embperl (embperl.log) going through the _base.epl file then to each of the other parts of the template.  When the *.pl script is run the embperl.log file shows the new APPNAME 'test" and only _base.epl being found and imported, I don't see references to any other piece of the template and none of the template is sent to the browser.  I've attempted many variations on Embperl::Object::Execute including specifying appname, object_base/object_addpath, and inputfile values.

Am I way off on how I am trying to use Embperl::Object::Execute in this way?  For the purposes of this exercise I want to avoid a complete conversion to Embedded perl within .html files.

Thanks for the help,

Chris

Reply via email to