[Catalyst] Why no extra attributes on Private actions?
Bill Moseley
moseley at hank.org
Sun Aug 16 17:40:33 GMT 2009
On Sat, Aug 15, 2009 at 4:28 PM, Eden Cardim <edencardim at gmail.com> wrote:
>
> > Is there a specific reason that Private actions may not have additional
> > attributes?
>
> You can achieve the same effect by using the :Action tag instead, as
> mst suggested in reply to the same thread:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg01413.html
Yes, I read that back then. That wasn't my question, though. My question
was *why* Private actions cannot have additional attributes?
Why is there code to explicitly prevent additional attributes on Private
methods? Especially since there's a work-around by simply using :Action (or
just any attribute) to make a method into an action.
Perhaps only Marcus might be able to answer that if he added that code.
Further, if *any* attribute can make a method into an action, is there
chance at some point that only a pre-defined set of attribute values would
be valid? Not sure there is any reason to do this, but for example might
want to have sub attributes on methods that are *not* actions, too.
BTW -- :Action is mentioned in the docs at:
http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/=
Intro.pod#Controllers
But, the text says:
Note that you can also supply attributes via the Controller's config so long
> as you have at least one attribute on a subref to be exported (:Action is
> commonly used for this) - for example the following is equivalent to the
> same controller above:
>
That doesn't sound correct. I think just listing the method in config
"actions" is enough. That is,
__PACKAGE__->config( actions =3D> { foo =3D> { Path =3D> 'bar' } } );
> sub foo {}
>
will work because configured "actions" method names are just pushed onto the
list of method names returned by
$meta->get_nearest_methods_with_attributes. No ":Action" (or any attribute)
required.
-- =
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090816/17d13=
104/attachment.htm
More information about the Catalyst
mailing list