Skip to content

Instantly share code, notes, and snippets.

@jberger
Created January 16, 2013 17:39
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/4549078 to your computer and use it in GitHub Desktop.
Save jberger/4549078 to your computer and use it in GitHub Desktop.
On Plugins ... Part 1
#!/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');
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;
@jberger
Copy link
Author

jberger commented Jan 16, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment