The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Dancer::Plugin::BeforeRoute - Run something before a specific route run

SYNOPSIS

 use Dancer::Plugin::BeforeRoute;

 before_route get => "/", sub {
     var before_home => 1;
 };

 get "/" => sub {
     ## Return 1
     return var "before_home";
 };

 get "/foo" => sub {
     ## Return nothing
     return var "before_home";
 };

DESCRIPTION

Most developers add lines of if-else to do something in before sub before run a path.

Or some people has lot of before hook with duplicated code to check path to run before running a path.

But I think we can do it better, No big sub and no duplication checks. Use this plugin please!:)

Tell me if you have a better idea.

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.