Skip to content

Commit

Permalink
Merge pull request #746 from sukria/feature/before_hook_param
Browse files Browse the repository at this point in the history
Pass route handler to before hooks
  • Loading branch information
bigpresh committed Feb 16, 2012
2 parents a1b2fce + 0366507 commit 2c9c790
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Dancer.pm
Expand Up @@ -638,7 +638,8 @@ Defines a before filter:
};
The anonymous function given to C<before> will be executed before executing a
route handler to handle the request.
route handler to handle the request. It will receive a reference to the route
handler about to be executed as its parameter.
If the function modifies the request's C<path_info> or C<method>, a new
search for a matching route is performed and the filter is re-executed.
Expand Down
2 changes: 1 addition & 1 deletion lib/Dancer/Renderer.pm
Expand Up @@ -98,7 +98,7 @@ sub get_action_response {
my $app = ($handler && $handler->app) ? $handler->app : Dancer::App->current();

# run the before filters, before "running" the route handler
Dancer::Factory::Hook->instance->execute_hooks('before');
Dancer::Factory::Hook->instance->execute_hooks('before', $handler);

# recurse if something has changed
my $MAX_RECURSIVE_LOOP = 10;
Expand Down

0 comments on commit 2c9c790

Please sign in to comment.