Created
December 20, 2012 03:40
-
-
Save anonymous/4342765 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Mojolicious::Lite::GetPost; | |
use Mojo::Base -base; | |
use Mojo::Util 'monkey_patch'; | |
sub import { | |
my $caller = caller; | |
my $app = $caller->can('app')->(); | |
monkey_patch $caller, 'get_post', sub { | |
return $app->routes->any([qw(GET POST)], @_); | |
}; | |
} | |
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojolicious::Lite; | |
use Mojolicious::Lite::GetPost; | |
get_post '/' => {text => 'Hello World!'}; | |
app->start; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment