Thanks Lance for your reply.
I have already put $|=1 at the beginning of the script. Actually the output
is not blocked.
And I have changed the script to:
sub template_parse
{
my $template_file = shift;
my $vars_hashref = shift;
print 'before creating Template->new';
my $tt = Template->new({INTERPOLATE => 1, INCLUDE_PATH =>
["$root/cgi-bin"]}) ||
do{ open F, ">$root/cgi-bin/errorlog.txt"; print F "$Template::ERROR\n";
close F;};
print 'after creating Template->new';
my $parsed;
$tt->process($template_file, $vars_hashref, \$parsed) or die $$tt->error;
return \$parsed;
}
after call the template_parse subroutine, there is no errorlog.txt exist at
all and the output is still the same. It looks like the program exit inside
the Template->new and it get lost.
It could be the problem of server resource shortage?
----- Original Message -----
From: "Lance Braswell" <[EMAIL PROTECTED]>
To: "Anya" <[EMAIL PROTECTED]>
Sent: Tuesday, July 05, 2005 2:32 PM
Subject: Re: [Templates] very strange Template->new behave
> Try running with $|++ at the top of your script. Maybe
> it's making it past the new and your program is
> blocking on writing to the $template_file. Since
> stdout may be buffered you aren't seeing it.
>
> Alternately write the debug output to a file.
>
> --- Anya <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I have a strange problem on Template->new() method
> > on Template Toolkit in a cgi script.
> >
> > The program just stops at Template->new() instead of
> > creating a new object. Could anybody give me some
> > clues on how to resolve it?
> >
> > Thanks in advance.
> >
> > Anya
> >
> >
> > The program looks like:
> >
> > sub template_parse
> > {
> > my $template_file = shift;
> > my $vars_hashref = shift;
> >
> > print 'before creating Template->new';
> > my $tt = Template->new({INTERPOLATE => 1,
> > INCLUDE_PATH => ["$root/cgi-bin"]}) || die
> > "$Template::ERROR\n";
> > print 'after creating Template->new';
> >
> > my $parsed;
> > $tt->process($template_file, $vars_hashref,
> > \$parsed) or die $$tt->error;
> >
> > return \$parsed;
> > }
> >
> > The output is
> > before creating Template->new
> >
> >
> >
> >
> >
> > it stops at my $tt.....; and no error message shows.
> >
> > This subroutine is inside a cgi script with a https
> > request to another server with XML format. Template
> > toolkit is used to display the response.
> > The same subroute works at other cgi scripts without
> > https request.
> >
> >
>
>
>
>
> ____________________________________________________
> Yahoo! Sports
> Rekindle the Rivalries. Sign up for Fantasy Football
> http://football.fantasysports.yahoo.com
>
>
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates