> I'm coming in late and trying to catch up on this.

Welcome to the party!

> Let me come at this from a different direction. Is
> CGI::Application::Dispatch so deficient that it needs to be scrapped or
> receive a major overhaul?

I use CGI::Application::Dispatch.  I think it's great for what it does
and I don't want to criticize it.  I especially think that Michael did a
good job in pushing the idea of using dispatching with CGI::Application
instead of always using one instance script per app.

I think when I've encountered limitations with CA::Dispatch, it is
because I've tried to get it to do things it wasn't designed for.

CA::Dispatch remains simple and easy to use, but my own subclass of it
is way too complex and arcane.  It has evolved to the point that it is
several times the size of CA::Dispatch, and it now does all the URL 
parsing itself.  It is has essentially become a dispatcher on its
own.

A limitation I encountered with CA::Dispath is that it wants you to have
a single mapping policy for all the URLs on your site.  Maybe this works
for some people?  It didn't work well with what I was trying to achieve.

I wanted this fairly simple map:

    /app/some_module/foo       => MySite::Some::Module
                                  (rm = foo)

    /app/some_module           => MySite::Some::Module
                                  (rm = )

    /app/admin/some_module/foo => MySite::Admin::Some::Module
                                  (rm = foo)

    /app/admin/some_module     => MySite::Admin::Some::Module
                                  (rm = )

It's that last one that's a problem.  A dispatch system with a
single mapping policy will translate that into:

    module = MySite::Admin,  rm = some_module

This can be solved very easily if you allow multiple URL maps based on
static string prefixes:

    /app           => MySite::
    /app/admin     => MySite::Admin


CA::Dispatch does allows table-based matching but it isn't flexible
enough to handle this.

    My::Dispatch->dispatch(
        RM     => 1,
        TABLE  => {
            'app'        => 'MySite',
            'app/admin'  => 'MySite::Admin',  # won't work
        }
    );


The first limitation is that URLs in the table can't have slashes in
them.  The second limitation is that each URL in the table must be an
exact match.  In other words you can't expect /app/some_module to match
against 'app'.

So I subclassed CA::Dispatch and wrote my own table handling.  Which was
fine.  But now, as I say, my subclass has become a full table-based
dispatcher in its own right that really should be replaced with
something more well-thought out and robust and general purpose.

Ultimately, all I want from a "Next Generation" dispatcher is some kind
of flexible /string/:app/:rm matching.  I don't personally need any of
that parameter parsing stuff.


Michael



---
Michael Graham <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to