Skip to content

Instantly share code, notes, and snippets.

@jberger
Created January 16, 2013 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jberger/4549286 to your computer and use it in GitHub Desktop.
Save jberger/4549286 to your computer and use it in GitHub Desktop.
On Plugins ... Part 3
# This does the same as Part 2 without doing the automagic loading.
# DONT DO THIS REGULARLY, because part of the system might change,
# the ->plugin loading abstracts you from that
package MyApp;
use Mojo::Base 'Mojolicious';
use Mojolicious::Plugin::MyPlugin;
sub startup {
my $self = shift;
my $plugin = Mojolicious::Plugin::MyPlugin->new;
$plugin->register($self);
$self->routes->any( '/' => sub {
my $c = shift;
$c->render( text => $c->random );
});
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment