[Catalyst] Often used templates as method

Daniel McBrearty danielmcbrearty at gmail.com
Mon Aug 13 13:21:59 GMT 2007

well, if you make the structure of your templates mirror that of your
controllers and actions, and use the end action that is shown in the
tutorial, you don't have to define the template per action - the
request gets automatically routed to the one with the same name as the

On 8/13/07, Sven Eppler <sven at sveneppler.de> wrote:
> Hello!
> I'm using catalyst with TT as my template engine. I made some templates
> for errors, warnings, messages, redirecting and stuff. But because i'm a
> quite a lazy boy i don't like to do this:
> $c->stash->{title} = "Some Error Title";
> $c->stash->{message} = "Some error message";
> $c->stash->{template} = 'box/error';
> over and over again. Beside my lazyness, this would even help me out if i
> deicide to rename the template sometime or stuff like this. So i thought
> about a better way. Which eventually should be a method which resides in
> the View itself. Something like:
> $c->view('TT')->error('Some Error Title', 'Some error message');
> But my first shot got me in some trouble: in the view i only get the
> reference of the view but not the catalyst context variable passed by. So
> i'm quite helpless how to proceed from there?
> Maybe even my approach is totaly wrong, but then i would appreciate any
> suggestions in the right direction. :)
> Thanks in advance,
> Sven
> _______________________________________________
> List: Catalyst at 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/

Daniel McBrearty
email : danielmcbrearty at gmail.com
find me on linkedin and facebook
BTW : 0873928131

More information about the Catalyst mailing list