On 8 Nov 2007, at 15:59, Gerda Shank wrote:
I'm trying to learn Catalyst by working my way through the
tutorial and other docs, and I'm a little puzzled by the View
directory. In the tutorials it only has a TT.pm file in it, which
is a config file for Template Toolkit. Are there ever any other
kinds of files in that directory? The files that would be
considered views in other MVC frameworks (the .tt files, I guess)
are put into the root/src and root/lib directories instead of the
View directory. Why?
One that jrockway didn't answer.
The template files in root/wherever (you're using TTsite which is
fine for the tutorial but don't be tempted to use it routinely) are
editable template files that don't require an app restart to
refresh. So you can edit your templates and reload. They're not
really code, although template-toolkit contains some programming
constructs optimised for templating rather than for general purpose
computing.
TT.pm is the file that contains the programming logic for rendering
your view. You can do stuff like set http headers, automatically add
stuff to the stash/session/whatever and co in here. It inherits from
Catalyst::View::TT the vanilla version of which looks like this:
~$ cat Desktop/dev/WIAB/trunk/WIAB/lib/WIAB/View/TT.pm
package WIAB::View::TT;
use strict;
use base 'Catalyst::View::TT';
# snip a bunch of auto-generated docs
1;
Compare that to what Catalyst::Helper::View::TTSite has produced for
you and it might start to make some sense...
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/