Michael CH Vu


Dancer::Plugin::BeforeRoute - A before hook for a specify route or routes


 use Dancer::Plugin::BeforeRoute;

 before_route get => "/", sub {
     var before_run => "homepage";

 get "/" => sub {
     ## Return "homepage"
     return var "before_run";

 ## Only for GET /foo
 before_route get => "/foo", sub {
     var before_run => "foo"

 ## Only for GET /foo
 before_for template_render => get => "/foo" => sub {
     my $stash = shift;
     $stash->{foo} = "bar"; 

 get "/foo" => sub {
     ## Return "foo"
     return var "before_run";


Dancer provides hook before to do everythings before going any route.

This plugin is to provide a little bit more specifically hook before route or route(s) executed.


Michael Vu, <micvu at cpan.org>


Please report any bugs or feature requests to bug-dancer-plugin-beforeroute at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dancer::Plugin::BeforeRoute. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Dancer::Plugin::BeforeRoute

You can also look for information at:


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.