Created
January 16, 2013 17:39
-
-
Save jberger/4549078 to your computer and use it in GitHub Desktop.
On Plugins ... Part 1
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
#!/usr/bin/env perl | |
use Mojo::Base -strict; | |
use FindBin; | |
use lib "$FindBin::Bin/lib"; | |
# Start commands for application | |
require Mojolicious::Commands; | |
Mojolicious::Commands->start_app('MyApp'); |
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
package MyApp; | |
use Mojo::Base 'Mojolicious'; | |
sub startup { | |
my $self = shift; | |
$self->helper( random => sub { rand } ); | |
$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
Continued in part 2: https://gist.github.com/62db71eda22965066fa0
and part 3: https://gist.github.com/4549286
I didn't mean to hit private on the second (and probably most important) part