From dfcd338e0693370eeaa95ca1f4ef8c742221b348 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Fri, 2 Apr 2004 17:53:44 +0000 Subject: [PATCH] Finished view documentation, refactor TT->base, and add Mason view class. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@113 48953598-375a-da11-a14b-00016c27c3ee --- doc/View.pod | 93 +++++++++++++++++++++++++++++++++++-- lib/Maypole/View/Base.pm | 87 +++++++++++++++++++++++++++++++++++ lib/Maypole/View/Mason.pm | 61 ++++++++++++++++++++++++ lib/Maypole/View/TT.pm | 97 +++++++++++---------------------------- 4 files changed, 264 insertions(+), 74 deletions(-) create mode 100644 lib/Maypole/View/Base.pm create mode 100644 lib/Maypole/View/Mason.pm diff --git a/doc/View.pod b/doc/View.pod index d2fda75..c469100 100644 --- a/doc/View.pod +++ b/doc/View.pod @@ -420,8 +420,91 @@ system which embeds pure Perl code inside its magic tags. The good side of this is that it can get into hash references and objects, and so providing C, C and the Maypole request object will work out just fine. The down side is that C is used to -having all the template variables it wants already at its disposal -through CGI parameters and the like, so we have to fiddle a bit to get -these variables into our template. - - +running more or less standalone, and having all the template variables +it wants already at its disposal through CGI parameters and the like, so +we have to fiddle a bit to get these variables into our template. + +The key to building view classes is C. This is the +base class that you're going to inherit from and, to be honest, it does +pretty much everything you need. It provides a method called C +which returns a hash of all the template variables described above, so +it would be good to feed those into C. It also provides a +C method which turns returns the full filesystem path of the +three possible template paths as shown above. Again, it would be good to +use this as our component paths if we can. It also has some methods we +can override if we want to, but they're not massively important, so you +can see L for more about them. + +The module will do the right thing for us if we agree to provide a +method called C