in reply to Re^5: apache + modperl problem
in thread apache + modperl problem

Hi jdrago_999,

Thanks for the reply.

Yes, I did try the sample code and that all works fine. I am happy that my mod_perl/perl/Apache are all installed ok.

My site works fine using HTML::Template. When I switch to use Template I get the error:
[Wed Apr 01 09:28:54 2009] [crit] (22)Invalid argument: Parent: Failed + to create the child process. [Wed Apr 01 09:28:54 2009] [crit] (OS 6)The handle is invalid. : mast +er_main: create child process failed. Exiting. [Wed Apr 01 09:28:54 2009] [notice] Parent: Forcing termination of chi +ld process 2670888
Everything works fine from the command-line, it just crashes when I run through apache.
I have set up my site so that the template engine is swappable and am using HTML::Template::Filter::TT2; so that the templates are exactly the same between HTML::Template and Template::Toolkit
Here is the working Template code for HTML::Template
sub Render { my $proto = shift; my ($params, $data, $template, $base_template_dir) = @_; my $engine = HTML::Template::Expr->new(filter => \&ht_tt2_filter, filename => $base_templat +e_dir.'/'.$template, die_on_bad_params=>0, encoding => ':utf8'); $engine->param($params); $engine->param($data); print $engine->output; }
Here is the corresponding code for Template::Toolkit which crashes
sub Render { my $proto = shift; my ($params, $data, $template, $base_template_dir) = @_; my $tt = Template->new({INCLUDE_PATH => $base_template_dir, INTERPOLATE => 1}) || croak("$Template::ERROR\n"); $tt->process($template, { params => $params, data => $data } ); }
and are called are called via
$TEMPLATE_ENGINE->Render(@_, $TEMPLATE_DIR);
where $TEMPLATE_ENGINE is the appropriate prototype.

I'd appreciate any help you can give me.

Thanks

Replies are listed 'Best First'.
Re^7: apache + modperl problem
by scotbert (Initiate) on Apr 01, 2009 at 11:55 UTC
    I found a 'fix'

    If I remove "INTERPOLATE => 1" from the initialiser it doesn't crash

      Yeah that's pretty strange.

      Have you taken a look at Apache2::ASP? Depending on what you're up to, it might feel a little more natural than *::Template::*