The extension is not part of the regex. The extension is stored in the "format" stash variable. I'm sure you're wrong about "doesn't match .htm" It probably match, but it doesn't complete the render step because you don't have a "template.htm.ep" file. Try running morbo in debug mode, and you will see that it doesn't find the correct template.
http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Formats http://mojolicio.us/perldoc/Mojolicious/Controller#respond_to http://mojolicio.us/perldoc/Mojolicious/Controller#stash On Sunday, February 15, 2015 at 11:55:40 AM UTC+1, Stanislav Blinov wrote: > > Ok, but :year and :month are generic placeholders. According to docs, they > match "match all characters except / and ." > Why .html with dot is matched? > Also I have restricted month and year to only numerics: month => > qr/\d{2}/, year => qr/\d{4}/ > Why it matches .html? > Also, this route: $cms_route->route('/members/branches')->to(controller > => 'Admin::Members', action => > 'edit_branches_list')->name('edit_members_branches'); > Matches /members/branches.html > But not /members/branches.htm > > 2015-02-15 13:30 GMT+03:00 Jan Henning Thorsen <[email protected]>: > >> The reason is that you have default values set for :year and :month, so >> they get "filled in", when not specified. >> >> >> On Sunday, February 15, 2015 at 10:43:27 AM UTC+1, Stanislav Blinov wrote: >>> >>> Hi, >>> I have a route: >>> $r->get('/news/:year/:month' => [month => qr/\d{2}/, year => >>> qr/\d{4}/])->to(controller => 'news', action => 'view', year => 2015, month >>> => 01, page => 1, id => $news_id); >>> >>> My intention is that it only should work for these type of urls: >>> /news/ >>> news/2015/ >>> news/2015/01 >>> >>> However, it also works when I call /news.html >>> >>> What is wrong with it? >>> I have also tried adding .html to another routes and it seems that they >>> open the same page as a route without .html >>> >>> Mojolicious 5.79. >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
