[Maypole] Template DEBUG, warnings and new

Dave Howorth dhoworth@mrc-lmb.cam.ac.uk
Tue, 14 Dec 2004 13:09:33 +0000


I'm trying to turn Template debugging on, so I can say things like
  [% DEBUG on %]

It seems to do that I need to add  DEBUG => DEBUG_DIRS to the options 
when the template processor is created in Maypole::View::TT.pm. So until 
the next release comes along, I'm patching the code. I replaced this:

   my $template = Template->new( { INCLUDE_PATH => [ $self->paths($r) ] } );

with this:

     my $template = Template->new( {
         INCLUDE_PATH => [ $self->paths($r) ],
         DEBUG => DEBUG_DIRS,
     } );

but then my Apache error log showed:

   caught view error: Can't call method "process" on an undefined value

I put a print in just after the new:

   print STDERR "template='$template'\n";

which gave:

   template=''

Can anybody see what is wrong with my code that's causing new to fail? 
Or does anybody know how to get a diagnostic from it?


I noticed that my print statement wasn't producing a warning (my driver 
class has use warnings). So I put use warnings into Maypole::View::TT 
and sure enough saw:

   Use of uninitialized value in concatenation (.) or string

just before my print statement. Does anybody know what is turning off 
warnings somewhere inside Maypole?

Thanks, Dave