Jean-Sebastien Guay wrote:

Steve,



How did you build Apache 2?



I downloaded the binaries... Sorry, can't help there.


Please keep me posted as to your progress.


OK, I've now got Apache 2 building (with a little off-list help from Randy Kobes - the secret is to use the .zip sources rather than the .tar.gz sources!), and I've built mod_perl 1.99_09 (not 1.99_10-dev as your have) and the good news for you is that I've reproduced your problem.

The bads news is that I haven't solved it, but I'll keep trying and let you know if/when I do.

I don't any Application Error popup window, but my NS7.1 browser says "The document contained no data", while IE6.0 gives the usual useless "The page cannot be displayed" crap that it always does.

I also get nothing in the access.log.

The error.log contained this:

Variable "$template" will not stay shared at C:/apache2/perl-bin/index.cgi line 26.
Variable "$vars" will not stay shared at C:/apache2/perl-bin/index.cgi line 26.
[Thu Aug 14 10:37:04 2003] [notice] Parent: child process exited with status 128 -- Restarting.


The "variable will not stay shared" error is a common problem with mod_perl scripts that have file-scope lexical variables in them which subroutines access. My usual solution is to put the main part of the program into a block labelled "MAIN:". That way they can't be "shared" to start with, and I have to explicitly pass them into any subroutines that require them. The attached new version of your "index.cgi" does this, and makes these errors go away. I now have just this in the error.log:

[Thu Aug 14 10:41:42 2003] [notice] Parent: child process exited with status 128 -- Restarting.

The index.cgi program runs fine in a command prompt (with SCRIPT_ROOT set in the environment), so its not an obvious TT error.

TTYL,

Steve
#!D:\perl\bin\perl -w
#-----------------------------------------------------------------------
use strict;
use warnings;

use Template;

MAIN: {
    #-------------------------------------------------------------------
    my $vars = {
        VERSION => 0.75,
    };

    # Template toolkit config.
    my $config = {
        INCLUDE_PATH => $ENV{SCRIPT_ROOT},
        INTERPOLATE  => 1,  # expand "$var" in plain text
        POST_CHOMP   => 1,  # cleanup whitespace
    };

    my $template = Template->new($config);
    #-------------------------------------------------------------------

    print qq[Content-Type: text/html\n\n];

    processTemplate($template, 'header.html.tmpl', $vars);

    #print qq[<html><head><title>Apache should hopefully 
crash...</title></head><body>];

    print plural('bottle', $_) . " of beer on the wall, <br>" .
          plural('bottle', $_) . " of beer, <br>" .
          "Take one down and pass it around, <br>" .
          plural('bottle', $_ - 1) . " of beer on the wall.<br><br>\n"
        foreach (reverse (1 .. 99));

    print qq[</body></html>];
}

#-----------------------------------------------------------------------
sub processTemplate {
    my $template = shift;
    my $t_file = shift;
    my $vars = shift;
    $template->process($t_file, $vars)
        or die("Error pressing $t_file: " . $template->error);
}

sub plural {
    my ($word, $number) = @_;
    return ($number == 0 ? 'no' : $number) .
           " $word" .
           ($number == 1 ? '' : 's');
}

Reply via email to