[Catalyst] Beginner question: View directory

Ash Berlin ash_cpan at firemirror.com
Thu Nov 8 09:22:58 GMT 2007


Dave Rolsky wrote:
> On Thu, 8 Nov 2007, Kieren Diment wrote:
>
>> Good call, my mistake.  Goes to show that there's not usually much 
>> (or any) extra stuff that needs to be done in the View class.  I was 
>> actually struggling to think of code related things  (rather than 
>> config) which  you might want to put in there.   Personally I've 
>> always munged headers in the sub end : ActionClass(’RenderView’) {} 
>> subs (see perldoc Catalyst::Action::RenderView for details).
>
> I have a few bits of code in my view class, but not much.
>
> For the Mason view, I had subclass new() and chown() all the files 
> created by the Mason Interp object to make things happy under 
> mod_perl. Mason has this built-in to its mod_perl integration, but 
> that doesn't get used with Catalyst.
>
> I also have a method has_template_for_path() which does what it says. 
> I call this from some controller auto() methods where the URI in 
> question is basically static content that doesn't need a separate 
> controller method.
>
>
> -dave
>
Similarly, I setup subs that I always want aviabale in the TT stash, 
such as format_datetime (which formats a DateTime object according do 
the currently logged in user's prefernce.) I also assing VMethods to 
$Template::Whatever::SCALAR_OPS here, since this seems like the place 
that such code belonds.

-ash




More information about the Catalyst mailing list