Michael CH Vu

NAME

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

SYNOPSIS

 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";
 };

DESCRIPTION

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.

AUTHOR

Michael Vu, <micvu at cpan.org>

BUGS

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.

SUPPORT

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

    perldoc Dancer::Plugin::BeforeRoute
 

You can also look for information at:

ACKNOWLEDGEMENTS

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