Include the method, and the pattern the compiled regex was generated from.
Re-implementing auto_page feature with more sanity
Before, it could return true if a directory with the given name existed, which isn't what we want. See also c0f1c33 for a similar change.
No need for a silly warning if view_exists() is passed undef.
Test that views in subdirs are served appropriately, and that directory indexes (e.g. requesting /foo/ gets views/foo/index.tt) work.
For some reason, t/03_route_handler/18_auto_page.t expected a non-existent page to return a 500 error rather than a 404, which seems stupid and wrong. Unless I'm missing something, this test was merely expecting retarded behaviour which was previously present, and needs to be updated for now-sane behaviour.
Replace detailed docs with a pointer to the hook keyword.
fix test failure introduced in 65e84b2
Pass route handler to before hooks
When calling a before hook, pass a reference to the route handler about to be executed as a parameter.
Mention the method when a route crashes.
If we don't find a direct match for `views/$path`, try appending `/index` to the path and looking again. This means that, if the request was for `/foo` and we didn't have `views/foo`, we'll then look for `views/foo/index.tt`, and use that if found. This is something I've missed for a long time, and makes the auto_page feature a lot more useful, I think.
Instead of adding a route to the app to catch requests for /:page and see if we can handle that, and pass if not, add a new `render_autopage()` to `Dancer::Renderer` which is called by `Dancer::Handler` if no route / static file matched. This immediately makes the auto_page feature more usable, as it can handle sub-directories properly now (e.g. given a request for `/foo/bar`, a view named `foo/bar.tt` will be rendered, as you'd expect). (Heh, look at that - the commit message explaining is almost as long as the code needed to just fucking do it :) )
There's a far better way coming in the next few commits.
Dancer::Template::Abstract::view() used `-e` to test for existence of a view to render; this means it would return directory names, which is obviously not good - a directory can't be rendered as a view :)
Things I found as a first time dancer user
This provides a consistant example throughout the documentation.
on line 30 of Hook.pm. Why not just have all the examples refer to before_template_render instead.
previous functions have been deprecated since version 1.3080.
Prompted by @DrHyde. It was already documented, but not in big flashing red capitals, so was somewhat obscured by the awesomeness of his beard, I believe.
In the example for exporting only the "route controllers", remove before & after (as they're deprecated, and it's arguable whether they ever really belonged there), and add del. Prompted by @skington - cheers Sam.
…4be2b6d76 Handle UTF8 more robustly
Thanks again @bor :)
Fixes GH-738. (Arguably, though, the code that showed up this missing exception type ought to use Core::Route, I think, as the issue is that `params` was called wrongly from within a route handler - the problem isn't with the request. I guess it comes down to, should the exception type indicate the point the exception was raised, or the original source of the problem, if known?)