[Catalyst] Catalyst::View::TT - strange caching annoyance

Einon einon at animehq.hu
Wed Sep 13 17:14:48 CEST 2006


I found an interesting bug in Catalyst::View::TT. Catalyst caches wrong 
templates even if I do not use caching.

I created a fresh application with catalyst.pl, added some templates,
modified the MyApp.pm according to my needs, and finally I added a TT view.

After fireing up the application with './script/myapp_server.pl -d' I 
checked if it works. It did. Then I modified the Display.hu.tt template 
to get a syntax error (I did this with removing the [% END %] block of 
the IF conditon.

When I called the default handler again, of course I got error:
[error] Coldn't render template "file error - parse error - 
Display.hu.tt line 9: unexpected end of input"
After this I put back the [% END %] block and reloaded the page,
catalyst sent me an another message:
[error] Coldn't render template "file error - setup: not found"
After restarting the cat app, the same template works again.

Sorry for this kind of bugreport... :)


Commands to reproduce this:
catalyst.pl MyApp; cd MyApp
mkdir root/master
mkdir root/include
cat >root/Display.hu.tt <<EOF
[% INCLUDE master/popup.hu.tt %]

[% BLOCK default %]
  [% INCLUDE calendar %]
  This here is the default with an IF statement<br>
  [% IF 1 == 1 %]Works[% END %]
[% END %]

[% BLOCK setup %][% END %]
cat >root/master/popup.hu.tt <<EOF
[% INCLUDE include/common.inc %][% PROCESS include/common.inc %]
[% INCLUDE setup rows=5 %][% PROCESS setup %]
[% INCLUDE default %]

cat >root/include/common.inc <<EOF
[% BLOCK calendar_init %][% END %]
[% BLOCK linker_search %][% END %]
[% BLOCK calendar %][% END %]

cat >lib/MyApp.pm <<EOF
package MyApp;

use Catalyst::Runtime '5.70';
use Catalyst qw/-Debug ConfigLoader Static::Simple DefaultEnd/;

sub default : Private {
   shift; # sorry cat command swallows dollar sign :)
   shift->stash->{template} = 'Display.hu.tt';


cat >lib/MyApp/View/TT.pm <<EOF
package MyApp::View::TT;

use strict;
use base 'Catalyst::View::TT';


rm lib/MyApp/Controller/Root.pm
./script/myapp_server.pl -d

More information about the Catalyst mailing list