perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kinetic Slam" <>
Subject Embperl::Object::Execute help within PERL scripts for templating.
Date Tue, 03 Oct 2006 16:00:48 GMT

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;
sub subTest {
        my $r = shift;
        my ($content,$cgienvvar);
        $content = "<HTML><BODY>";
        $content .= "<H1> Test </H1>\n";
        $content .= "</BODY></HTML>";
        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;
sub subTest {
        my $r = shift;
        my ($content,$cgienvvar);
        $content = "<H1> Test </H1>\n";
                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_DEBUG 0x7fffffff
    PerlModule Embperl

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

        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
                SSLOptions +StdEnvVars
                AllowOverride None
                Options None +ExecCGI
                Order allow,deny
                Allow from all

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

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,


View raw message