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

Sometimes the mod_perl.so Apache module doesn't like some other compiled C Perl modules (like Template or parts of DBI).

Your best bet is to re-install Template from source. If CPAN tells you that "Template is up to date" just download it manually via wget and unzip/install by hand. That should take care of the problem.

Replies are listed 'Best First'.
Re^4: apache + modperl problem
by scotbert (Initiate) on Mar 31, 2009 at 09:05 UTC
    Did this problem get solved? I am experiencing *exactly* the same problem with exactly the same versions of Perl/Apache/mod-perl. I've tried uninstalling & reinstalling everything but the problem persists.

      Did you try the simple test listed above? Does it still "not work?"

      Are you getting error messages? What are they?

      Can you post some code?

        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