Before the calling to the subroutine, there was a database update which
write a text field with XML format to a table. If I remove the update of the
database, then the show_template can work. Otherwise the Template->new()
doesn't work. In fact the database was updated and no error returned. Don't
know why it affects the setup of the Template object.

Did anybody meet such things before? Is it due to the Memory Shortage of the
server?

Thanks.

----- Original Message -----
From: "Harald Joerg" <[EMAIL PROTECTED]>
To: "Anya" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Wednesday, July 06, 2005 4:42 PM
Subject: Re: [Templates] very strange Template->new behave


> Anya writes:
>
> > I have changed the script to:
> >
> > sub show_template #parse it right now
> > {
> >  my $template_file = shift;
> >  my $vars_hashref = shift ;
> >
> >  my $tt;
> >  print "in show_template 1<br>";
> >
> >  $tt = Template->new({
> >   INCLUDE_PATH => ["$root/cgi-bin"],
> >   INTERPOLATE  => 1,
> >  }) || do{ print "inside error" ; }  ;
> >  print "in show_template 2<br>";
> >
> >  $tt->process($template_file, $vars_hashref) ;
> > }
> >
> > at the beginning of the file:
> > #!/usr/bin/perl
> > use strict;
> > use Template;
> > use CGI::Carp qw(fatalsToBrowser);
> > use diagnostics;
> > $|=1;
> >
> > and the calling for the subroutine is:
> >
> > eval{
> > &show_template("some_template.html",$vartoparse);
> > };
> > [...]
>
> I'm lost why your program doesn't show anything in the error log.  So
> these are just some wild guesses to collect some information which
> might give some hints:
>
>  - I'm pretty sure that you didn't tie $root to some extremely strange
>    process which silently exit()s on FETCH? ;->
>
>  - Print %INC before creating the template.  Maybe (mod_perl comes
>    into my mind) for *some* paths in the server there are different
>    settings, e.g. for PERL5LIB than for *others*.
>
>  - Print %ENV, basically for the same reasons.
>
>  - Wrap your program into a simple shell script like this:
>
>      #!/bin/bash
>      PERLDB_OPTS="NonStop LineInfo=your.log.file frame=2" perl -d xx.cgi
>
>    (make sure that the web server is allowed to create and write to
>    your.log.file).  This prints a complete history of subroutine calls
>    and exits and might give a hint where exactly the program exits (or
>    hangs?).  Be aware that the output may be some MB if your program
>    does many things (e.g. CGI related) before vanishing.
>
> And anyway: Even if your program is designed to work as a CGI, I think
> it is always worthwile to create an environment where you can test it
> from the command line.  CGI.pm has this ability built-in, all you may
> need is to mock up some additional environment variables.
> --
> Cheers,
> haj
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://lists.template-toolkit.org/mailman/listinfo/templates
>
>


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to