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

2006-09-13 Thread Einon
Hi!

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... :)



Bye!
Einon



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 statementbr
  [% IF 1 == 1 %]Works[% END %]
[% END %]

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

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

cat lib/MyApp.pm EOF
package MyApp;

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

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

1;
EOF

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

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

1;

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

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2006-09-13 Thread Jason Kohles
On 9/13/06, Einon [EMAIL PROTECTED] wrote:
 Hi!

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

Regardless of whether you have Catalyst configured to do caching,
Template Toolkit does it's own in-memory caching by default.

From 'perldoc Template':

   Caching and Compiling Options

   CACHE_SIZE
   Maximum number of compiled templates to cache in memory (default:
   undef - cache all)

-- 
Jason Kohles
[EMAIL PROTECTED] - http://www.jasonkohles.com/
A witty saying proves nothing.  -- Voltaire

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2006-09-13 Thread Jonathan Rockway
However, TT should update its cache automagically (keyed on mtime) --
even if you use the full compiled (to-disk) template cache.

Questions:

0. What version of TT, Catalyst, and C::V::TT are you using?
  (Find out with perl -MCatalyst -e 'print Catalyst-VERSION', etc.)

1. Can you provide us with a case where regular TT correctly refreshes
the template, but C::V::TT doesn't?

2. If not (i.e. regular TT breaks too), do mtimes work on your system?

My guess is that something is wrong with your system; outdated TT, buggy
filesystem, etc.  It's very possible that I'm completely wrong, but my
templates are fully cached (on disk) and do update properly.  I haven't
tried the code you sent because it's too complicated and is certainly
not the minimum required to reproduce the bug.  Does:

cat  root/test.tt2  EOF
Hello, world?
EOF

change when you apply

- Hello, world?
+ Hello, world! This changed!

Something like that would be much simpler for me (and others) to test.
Thanks!

Regards,
Jonathan Rockway


Jason Kohles wrote:
 On 9/13/06, Einon [EMAIL PROTECTED] wrote:
 Hi!

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

 Regardless of whether you have Catalyst configured to do caching,
 Template Toolkit does it's own in-memory caching by default.



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2006-09-13 Thread Wade . Stuart






[EMAIL PROTECTED] wrote on 09/13/2006 11:53:41 AM:

 However, TT should update its cache automagically (keyed on mtime) --
 even if you use the full compiled (to-disk) template cache.

 Questions:

 0. What version of TT, Catalyst, and C::V::TT are you using?
   (Find out with perl -MCatalyst -e 'print Catalyst-VERSION', etc.)

 1. Can you provide us with a case where regular TT correctly refreshes
 the template, but C::V::TT doesn't?

 2. If not (i.e. regular TT breaks too), do mtimes work on your system?

3.  Please verify where, what fstype and what hw type (disk, lvm, vxvol,
tmp, tmpfs etc) for the mount point containing the templates.

 My guess is that something is wrong with your system; outdated TT, buggy
 filesystem, etc.  It's very possible that I'm completely wrong, but my
 templates are fully cached (on disk) and do update properly.  I haven't
 tried the code you sent because it's too complicated and is certainly
 not the minimum required to reproduce the bug.  Does:

 cat  root/test.tt2  EOF
 Hello, world?
 EOF

 change when you apply

 - Hello, world?
 + Hello, world! This changed!

 Something like that would be much simpler for me (and others) to test.
 Thanks!

 Regards,
 Jonathan Rockway


 Jason Kohles wrote:
  On 9/13/06, Einon [EMAIL PROTECTED] wrote:
  Hi!
 
  I found an interesting bug in Catalyst::View::TT. Catalyst caches
wrong
  templates even if I do not use caching.
 
  Regardless of whether you have Catalyst configured to do caching,
  Template Toolkit does it's own in-memory caching by default.

 [attachment signature.asc deleted by Wade
 Stuart/FALMSP/USA/NA/FALLON]
___
 List: Catalyst@lists.rawmode.org
 Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
 Searchable archive:
http://www.mail-archive.com/catalyst@lists.rawmode.org/
 Dev site: http://dev.catalyst.perl.org/


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2006-09-13 Thread Jonathan Rockway
Good find.  The whole complicated [% BLOCK %] business that I was
complaining about was actually the problem.  I admit to never having
used [% BLOCK %], so that's why I didn't run into the problem.

Regards,
Jonathan Rockway


Brian Kirkbride wrote:
 Einon wrote:
 Hi!

 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... :)



 Bye!
  Einon


 
 I have had this problem too, please see the solution here:
 
 http://www.mail-archive.com/catalyst@lists.rawmode.org/msg00823.html
 
 - Brian
 
 ___
 List: Catalyst@lists.rawmode.org
 Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
 Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
 Dev site: http://dev.catalyst.perl.org/



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2006-09-13 Thread Brian Kirkbride
Jonathan Rockway wrote:
 Good find.  The whole complicated [% BLOCK %] business that I was
 complaining about was actually the problem.  I admit to never having
 used [% BLOCK %], so that's why I didn't run into the problem.
 
 Regards,
 Jonathan Rockway
 

Ah, that makes sense.

What do you usually do in stead of using BLOCK?  Do you put anything that will 
be INCLUDEd or PROCESSed into separate files?  I tend to put all related small 
chunks of HTML, Javascript, etc into separate, named BLOCKs in a single .tt2 
file.  And for anything I'll be using on a regular basis, I make them MACROs 
instead.

Cheers,
Brian

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/