On 12/12/05, Michael Graham <[EMAIL PROTECTED]> wrote:
> PREFIX => 'MySite',
> TABLE => [
> 'blog/:rm' => { app => 'Blog' },
> 'admin/:app/:rm' => { prefix => 'MySite::Admin' }
> 'get/:path' => { app => 'GetDoc' }
> ':app/:rm' => { }
> ],
PREFIX is optional in Dispatch. What is the harm in this?
TABLE => [
'blog/:rm' => { app => 'MySite::Blog' },
'admin/:app/:rm' => { app => 'MySite::Admin' }
'get/:path' => { app => 'MySite::GetDoc' }
':app/:rm' => { }
]
> > It did for me though I'm still not clear to how a missing required
> > parameter is handled. (Who handles the error? The run mode or the
> > dispatcher?)
>
> Well, that's an argument against, right there. We're not doing input
> validation, but rather URI matching. So we don't have "required"
> parameters in the validation sense. It's simply that non-matching URIs
> don't match.
>
> So while these are duplicates:
>
> 'blog/:year/:month?/:day?' => { app => 'Blog' }
> 'blog/:page' => { app => 'Blog' }
>
> these aren't:
>
> 'blog/:year/:month/:day?' => { app => 'Blog' }
> 'blog/:page' => { app => 'Blog' }
>
> In the second case, /blog/2002/12 matches the first rule, but /blog/2002
> matches the second.
I had to read your example three times before I understood why which
is what I'm getting at. This still seems too confusing. It seems to me
there has to be a better way or perhaps, in order to support what you
propose, some form of simple regex pattern matching is required to
disambiguate URL patterns like in your first example. This way :year
can be defined as 4 digits (\d{4}) and will let single parameters fall
to another rule. Rails has such a feature in their routes. That left
side could get really gruesome looking if your patterns are complex
enough.
<tim/>
--
Timothy Appnel
http://www.timaoutloud.org/
---------------------------------------------------------------------
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]