Advertisement
Guest User

Untitled

a guest
Jul 13th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.63 KB | None | 0 0
  1. package Mojolicious::Plugin::Example;
  2. use Mojo::Base 'Mojolicious::Plugin';
  3.  
  4. our $VERSION = '0.01';
  5.  
  6. sub register {
  7.   my ($self, $app) = @_;
  8.  
  9.   push @{ $app->renderer->classes }, __PACKAGE__."::Controller";
  10.  
  11.   $app->routes->shortcut( something => sub {
  12.       my ($r, $name, $opts) = @_;
  13.  
  14.       # create routes to add/edit/delete/etc.
  15.   } );
  16. }
  17.  
  18. # somewhere else in the plugin...
  19. package Mojolicious::Plugin::Example::Controller;
  20.  
  21. sub add {
  22. }
  23.  
  24. # rest of base actions...
  25.  
  26. 1;
  27. __DATA__
  28. @@ example/add.html.ep
  29. <div>
  30. % # all kinds of generic wrappings, form_for, etc.
  31. % foreach my $field (@$fields) {
  32. # ...
  33. % }
  34. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement