Created
January 16, 2013 18:05
-
-
Save jberger/4549286 to your computer and use it in GitHub Desktop.
On Plugins ... Part 3
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
# 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