<div dir="ltr">And then, I raise the Dancer 2 flag:<br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/1/3 David Golden <span dir="ltr"><<a href="mailto:xdg@xdg.me" target="_blank">xdg@xdg.me</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><br></div>
Dancer doesn't (to my knowledge) have a way to have per-route hooks,<br>
or hooks for routes matching some criteria.<br>
<br>
before qr{^/private} => sub { ... };<br>
<br>
(This is the sort of thing that I think Catalyst does with 'begin'<br>
actions in controllers.)<br><br></blockquote><div><br></div><div style>If you mean Dancer 1, you're right, if you mean Dancer 2, you're wrong.</div><div style><br></div><div style>In Dancer 2, everything is scoped to the "app" it's defined, so doing that is preatty easy with D2:</div>
<div style><br></div><div style> package SomeApp;</div><div style><br></div><div style> hook 'before' => sub {</div><div style> };</div><div style><br></div><div style> # some routes</div><div style><br></div>
<div style>In this case, only the routes defined in SomeApp will have the filters defined. Only them. For more details about that feature, I suggest reading that article: <a href="http://advent.perldancer.org/2012/7">http://advent.perldancer.org/2012/7</a></div>
<div style><br></div><div style>Wouldn't that be a perfect opportunity to try a switch to Dancer 2?</div><div style> </div><div style>PS: you could actually do it in Dancer 1 with a test in the before filter like so:</div>
<div style><br></div><div style> hook before => sub { </div><div style> return pass if request->path !~ //;</div><div style> ...</div><div style> };</div><div style> </div></div></div></div>