[Catalyst] :Template() Attribute

Christopher H. Laco claco at chrislaco.com
Fri Jun 15 15:33:29 GMT 2007


Bill Moseley wrote:
> On Fri, Jun 15, 2007 at 09:58:06AM -0400, Christopher H. Laco wrote:
>>>     sub edit : Local : Template( 'edit.tt' ) {
>>>         my ( $self, $c ) =3D @_
>>>         ...
>>>     }
>>>
>>> instead of:
>>>
>>>     sub edit : Local {
>>>         my ( $self, $c ) =3D @_
>>>         $c->stash->{template} =3D 'edit.tt';
>>>         ...
>>>     }
>>>
> =

>> Yes. You can use both. Setting stash template always overrides the
>> default Template() attribute for that current action via ||=3D
> =

> Maybe I missed this in your first email, but what's the problem you
> are trying to solve?
> =

> =


Imho, :Template('foo') is a lot more elegant than $c->stash->{'template'}

Anytime I have to futz with hash contents that control functionality in
other things that I didn't write (like Views), it feels dirty...akin to
altering $self->{'option'} =3D 'foo' instead of doing $self->option('foo')

Just a personal preference, but I always prefer api (methods) over hash
molestation.

Just me being neurotic. :-)

-=3DChris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070615/5eac=
3dc3/signature.pgp


More information about the Catalyst mailing list