[Catalyst] Re: Overriding chained methods.

Bill Moseley moseley at hank.org
Sun Feb 19 02:18:53 GMT 2012


On Thu, Feb 16, 2012 at 7:40 AM, Bill Moseley <moseley at hank.org> wrote:

> Any suggestions?
>

Perhaps not.  And rightly so.

What I was asking it how to override potentially any method in a chain of
Actions and to magically swap the the root of the chain.  Sounds ugly and
confusing.

Perhaps a more sane approach is to capture the version number and for very
small API changes just return data conditionally on the version number, and
for anything more significant branch the app and run two versions at the
same time and deprecate the old version.

Or better, don't break backwards capability, and provide a version in the
response headers.



On Thu, Feb 16, 2012 at 7:40 AM, Bill Moseley <moseley at hank.org> wrote:

> I have an app that is naturally hierarchical, so to make up an example a
> path might be:
>
> /version1/country/12/region/31/state/12/city/45
>
>
> which I use Chained actions to implement.  And the Controllers follow that
> layout as well:
>
> App/Controller/Version1/Country/Region/State/City.pm
>
>
> Here's where I need some ideas:
>
> Say at some point I need to change the API for an action in the City.pm
> controller in a non-compatible way.  I woud like to be able to just
> override that ONE method in a new controller.  For example, by adding this
> (note the version number change)
>
> App/Controller/Version2/Country/Region/State/City.pm
>
>
> which contains just the method I want to override, and then "inherit" from
> the version 1.  Of course, ALL actions in version 1 would be available in
> version 2.
>
> I've have done something similar in the past, but without using Chained
> actions -- although in that case the need was for a set of /guest/ actions
> that had a subset of the app's actions, and I just had the /guest/*
> controllers inherit from the original controllers.
>
> Any suggestions?
>
>
> --
> Bill Moseley
> moseley at hank.org
>



-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120219/392ea=
26d/attachment.htm


More information about the Catalyst mailing list