Ok, now that you all have had time to play with this, please explain why this
is less difficult and unwieldy than mod_rewrite.

Seriously.

Another question: how is this at all relevant for cgiapp? Why should my apps
care about urls? All they need to know is that input comes through
$self->query->param, and output goes through $outputref in cgiapp_postrun.

Thirdly: Links belong in my templates, not in my app, so I have no business
knowing how to generate them.

Quarto: If the idea behind pretty urls is hiding the implementation details,
then the dispatcher should be decoupled from the app as much as possible too.
It should not need to know whether the app is RoR, Struts, Catalyst, or a
plain shell script. And we already have that in the form of mod_rewrite(*).

Why is every framework reinventing the same wheel over and over again?

Rhesa

(*) Web servers other than Apache better have something comparable...
I know that IIS doesn't, but then again, it doesn't handle path_info either.

Mark Stosberg wrote:
On 2005-12-08, Michael Graham <[EMAIL PROTECTED]> wrote:

How about this instead?

   :year:(\d{4})/:day:(\d{1,2}/:month:(\d{1,2})


That's OK, that's more like my original proposal (before I made the wiki
page). Django does something more like this. Here's some example of
their syntax:

(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 
'news.views.article_detail'),

The first one, without the names, is just very ugly. Our syntax would at
least be slightly less noisy. I further simplified it by removing the
extra colons:
 :year(\d{4})/:day(\d{1,2})/:month(\d{1,2})


Sure it's ugly, but at least the matching logic is all in one place.
Plus hopefully its ugliness discourages abuse.  We can even allow multi-
line commented maps (after a fashion):


   ':year:(\d{4})',      # year, e.g. 9008
   '/',
   ':day:(\d{1,2}',      # day, e.g. 99
   '/',
   ':month:(\d{1,2})',   # month, e.g. 72

                         => {  app => 'Blog'  rm => 'by_date' },


Hmm, maybe in v2.
<thinks more>

We could just make this a "qr" thingie, and get commenting like this for
free.

But that could be slightly confusing if we are using ":" and "?" in
special ways.  I don't mind the verbose syntax for declaring something
is optional.



But if the idea is to provide more matching logic to the routing system,
then maybe a different syntax could be used for optional parameters?

 ':year/?month/?day'


This would be OK too, although the question mark could begin to be
confused with the beginning of a query string in this case.

After all, isn't one of Perl's superpowers the ability to solve problems
with punctuation?


Yes. Punctuation is also Perl's kryptonite, so we need to be careful.

    Mark


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





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