Skip to content

Instantly share code, notes, and snippets.

@diegok
Created September 15, 2012 11:00
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 diegok/3727350 to your computer and use it in GitHub Desktop.
Save diegok/3727350 to your computer and use it in GitHub Desktop.
Mojolicious plugin for resque
package Mojolicious::Plugin::Resque;
use Mojo::Base 'Mojolicious::Plugin';
use Resque;
use strict;
has config => sub {{}};
has resque => sub { Resque->new(%{shift->config}) };
sub register {
my ( $self, $cfg ) = @_;
$self->config($cfg) if $cfg && ref $cfg eq 'HASH';
helper( resque => sub { $self->resque } );
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment