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