[cgiapp] C::A::P::Routes

Clayton Scott clayton.scott at gmail.com
Thu Mar 4 10:19:40 EST 2010


On Thu, Mar 4, 2010 at 9:57 AM, P Kishor <punk.kish at gmail.com> wrote:
> On Thu, Mar 4, 2010 at 8:53 AM, Clayton Scott <clayton.scott at gmail.com> wrote:
>> 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?

CAP::Dispatch is for instance scripts to dispatch requests to multiple
CGI::Application based applications based on the URL
and CAP::Routes is for dispatching a request to a runmode by matching
on the URL.

You could use CAP::Dispatch to do the full URL dispatch from URL match
to runmode but I didn't want to put that much
metadata about my apps in the instance script, and my URL scheme
wasn't that regular that I didn't need that metadata
hauled up to that level.

Here's why I used both:

My complete application consisted of many smaller applications
(blog editing, map editing, photo uploading, map rendering, dashboard
view etc). Like a good developer I
put related functionality into it's own CGI::App sub classes and used
CAP::Routes to define the clean URL to runmode mappings.
These apps also had a lot of libraries in common like the Data Access
Layer and Authentication Layer.

Like a good sysadmin, I did not want each of those CGI::Apps with it's
own instance script fighting for resources  (RAM!)
or being spun up and down by the FCGI manager so I wrote a single
instance script that loaded all of the Applications
into it and used CAP::Dispatch to choose which CGI::App module would
handle the request based on the root of the url.

This approach allowed me to separate my development concerns as
appropriate and to operate the application it in a flexible
and efficient manner.

Clayton



>
>
> --
> 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
> =======================================================================
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://lists.openlib.org/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>



-- 

Clayton Scott
clayton.scott at gmail.com


More information about the cgiapp mailing list