[Catalyst] Often used templates as method

Matt S Trout dbix-class at trout.me.uk
Mon Aug 13 16:43:24 GMT 2007


On Mon, Aug 13, 2007 at 01:50:54PM +0200, Sven Eppler 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:

Why not just wrap these up into a controller method?

$c->forward('/setup_error', [ $title, $message ]);

or whatever?

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/                    http://www.shadowcat.co.uk/ 



More information about the Catalyst mailing list