Timothy Appnel <[EMAIL PROTECTED]> wrote:
> 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'        => {  }
>      ]


Well, in 'admin/:app/:rm', what does ':app' do, since 'app' is already
specified in the results?  In particular, are you suggesting that the
following would still match?

    URL                 Module                 Run Mode
    ---                 ------                 --------
    /admin/users/edit   MySite::Admin::Users   edit
    /admin/users/add    MySite::Admin::Users   add
    /admin/users        MySite::Admin::Users

If so, then you seem to be suggesting that whatever ':app' matches in
the URL should be combined in some intelligent way with the value of
'app' in the results.  That seems too magical to me.  For instance, how
is it obvious that you want 'MySite::Admin::Users' and not
'Users::MySite::Admin'?  Prefix is much clearer.

IMO, 'app' should only be allowed in the results if ':app' does not appear in
the rule.  Similarly for 'rm' and ':rm'.


> > 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.

Yes, but these examples are deliberately contrived to illustrate the
mechanics of the mapping system, and the various edge cases.  They are
not meant to be real world examples.  If you used a mapping like the
above in real life, you get what you deserve, IMO.

Besides, the system can be designed to warn about inaccessible rules.


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