[cgiapp] C::A::P::Routes
P Kishor
punk.kish at gmail.com
Thu Mar 4 09:57:10 EST 2010
On Thu, Mar 4, 2010 at 8:53 AM, Clayton Scott <clayton.scott at gmail.com> wrote:
> On Thu, Mar 4, 2010 at 9:25 AM, Brad Van Sickle <bvansickle3 at gmail.com> wrote:
>> Tangential discussion on this... but what is the value in using
>> dispatching modules like CAP::Routes and CGI::Application::Dispatch?
>
>
> The big advantage for me when I decided to use CAP::Routes for a project
> was because a route is a declaration of what the url looks like and it
> will unpack
> variables out of the url for me, instead of messing with PATH_INFO myself.
>
> For example
> $self->routes([
> '/contacts/:action/?contact_id' => 'contact_create_update_delete'
> ]);
>
> is describes the url better than:
> $self->runmodes({ 'contact_cud' => \&contact_create_update_delete});
>
> Especially when you are performing ajax queries and the like you want to know
> what the url looks like and what runmode will be called.
>
> Clayton
>
> P.S. I've had great success in using CAP::Dispatch and CAP::Routes together
> my instance script loaded a bunch of CGI::App based modules and used
> CAP::Dispatch
> to assign root urls for each module (/contacts, /staff, /etc) then I
> used CAP::Routes to define the
> different url/variable/runmode combinations within each Application.
>
>
Interesting. Here I was dreaming of a situation where I could do away
with both CAD and CAPR, but you are showing me that you are actually
using both at the same time! Isn't that overkill? Can't you do what
you want completely with one or the other?
--
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
More information about the cgiapp
mailing list