Skip to content

Instantly share code, notes, and snippets.

@kraih
Created December 20, 2012 03:43
Show Gist options
  • Save kraih/4342795 to your computer and use it in GitHub Desktop.
Save kraih/4342795 to your computer and use it in GitHub Desktop.
package Mojolicious::Lite::GetPost;
use Mojo::Base -base;
use Mojo::Util 'monkey_patch';
sub import {
my $caller = caller;
monkey_patch $caller, 'get_post', sub {
return $caller->app->routes->any([qw(GET POST)] => @_);
};
}
1;
use Mojolicious::Lite;
use Mojolicious::Lite::GetPost;
get_post '/' => {text => 'Hello World!'};
app->start;
@naviltsev
Copy link

Kinda useful, vote for it to be in a cookbook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment