Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Path-Router CPAN distribution.

Report information
The Basics
Id: 47295
Status: open
Priority: 0/
Queue: Path-Router

People
Owner: Nobody in particular
Requestors: chris [...] cwinters.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.07
Fixed in: (no value)



Subject: Use URI templates instead of/along with existing notation?
URI templates are a proposed standard that's implemented in a number of platforms. It would be useful to declare the added routes with them. For instance, one of the examples from the documentation could become: ---------- $router->add_route('blog/{year}/{month}/{day}' => ( defaults => { controller => 'blog', action => 'show_date', }, # validate with ... validations => { # ... raw-Regexp refs year => qr/\d{4}/, # ... custom Moose types you created month => 'NumericMonth', # ... Moose anon-subtypes created inline day => subtype('Int' => where { $_ <= 31 }), } )); ---------- Google reveals a number of implementations, including one in LISP (!). Reference: http://bitworking.org/projects/URI-Templates/ Joe Gregorio is primarily a Python person; don't hold it against him :-)
On 2009-06-23 17:14:56, CWINTERS wrote: Show quoted text
> URI templates are a proposed standard that's implemented in a number of > platforms. It would be useful to declare the added routes with them. For > instance, one of the examples from the documentation could become:
I did a bunch of work on the Perl implementation of URI templates, and I would like to go on record saying that while the very early drafts were nice and simple, they later became intensely insane and I recommend avoiding them. The Rails-style "foo/:bar" is pretty commonly used, and not nuts. Also, URI templates are designed to be one-way render-from-input, rather than parse tools. -- rjbs