Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Mojolicious::Plugin::Example;
- use Mojo::Base 'Mojolicious::Plugin';
- our $VERSION = '0.01';
- sub register {
- my ($self, $app) = @_;
- push @{ $app->renderer->classes }, __PACKAGE__."::Controller";
- $app->routes->shortcut( something => sub {
- my ($r, $name, $opts) = @_;
- # create routes to add/edit/delete/etc.
- } );
- }
- # somewhere else in the plugin...
- package Mojolicious::Plugin::Example::Controller;
- sub add {
- }
- # rest of base actions...
- 1;
- __DATA__
- @@ example/add.html.ep
- <div>
- % # all kinds of generic wrappings, form_for, etc.
- % foreach my $field (@$fields) {
- # ...
- % }
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement