> > Not that we don't actually have to all agree on how dispatching should
> > work, since it's possible to have more than system for this.
>
> Again, the correct URL is http://www.cgi-app.org/?DispatchDesign
>
> Also, please remember that responding to RFCs give you one extra vote
> when voting for a new CGI::App name.
Yay! Four votes for me!
I like your dispatch proposal quite a lot, and I also agree with all of
Shawn's comments on the wiki. This module would certainly clean up the
dispatch code I'm using at work. For fun I tried rewriting my dispatch
table using the syntax you proposed, and its a lot cleaner. But it also
led to all the feature requests I put on the wiki :)
> Other feedback? Anyone interested in writing the code for this?
> (I was hoping to get out of that part of it... )
I have a feeling this is going to be a tricky module to write, because
when an URL matches multiple targets, the system has to choose the best
match. Static strings should be preferred against variable matches, and
maybe longer matches are considered more precise? (That's how
Config::Context does it anyway.)
For instance, with the URL /admin/users/edit, given the following
dispatch table, the fourth mapping should probably win because it
matches the longest static substring.
1. :app/:rm/:id => { }
2. admin/:app/:extra => { }
3. admin/:rm/:id => { app => AdminSystem }
4. admin/users/:rm => { app => UserAdmin }
(And at the same time, the system has to be smart enough to complain
that mappings 2 and 3 are equivalent.)
And then the same problem exists in reverse, when you try to implement
to_uri(). Given the following call:
$self->to_uri('app' => 'UserAdmin', rm => "edit", id => 23 );
and based on the above mapping table, you could end up with two URLs:
A. /UserAdmin/edit/23 (from map #1)
B. /admin/users/edit?id=23 (from map #4)
Which is the "correct" URL? URL B uses the most precise match (longer
static string), but URL A uses fewer query parameters and makes a
shorter, neater URL.
Of course, maybe the Rails people have already solved the algorithms to
do these things?
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]