/usr/share/perl5/Mojolicious/Plugin/Minion.pm is in libminion-perl 6.02-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | package Mojolicious::Plugin::Minion;
use Mojo::Base 'Mojolicious::Plugin';
use Minion;
use Scalar::Util 'weaken';
sub register {
my ($self, $app, $conf) = @_;
push @{$app->commands->namespaces}, 'Minion::Command';
my $minion = Minion->new(each %$conf);
weaken $minion->app($app)->{app};
$app->helper(minion => sub {$minion});
}
1;
=encoding utf8
=head1 NAME
Mojolicious::Plugin::Minion - Minion job queue plugin
=head1 SYNOPSIS
# Mojolicious (choose a backend)
$self->plugin(Minion => {Pg => 'postgresql://postgres@/test'});
# Mojolicious::Lite (choose a backend)
plugin Minion => {Pg => 'postgresql://postgres@/test'};
# Add tasks to your application
app->minion->add_task(slow_log => sub {
my ($job, $msg) = @_;
sleep 5;
$job->app->log->debug(qq{Received message "$msg"});
});
# Start jobs from anywhere in your application
$c->minion->enqueue(slow_log => ['test 123']);
# Perform jobs in your tests
$t->get_ok('/start_slow_log_job')->status_is(200);
$t->get_ok('/start_another_job')->status_is(200);
$t->app->minion->perform_jobs;
=head1 DESCRIPTION
L<Mojolicious::Plugin::Minion> is a L<Mojolicious> plugin for the L<Minion> job
queue.
=head1 HELPERS
L<Mojolicious::Plugin::Minion> implements the following helpers.
=head2 minion
my $minion = $app->minion;
my $minion = $c->minion;
Get L<Minion> object for application.
# Add job to the queue
$c->minion->enqueue(foo => ['bar', 'baz']);
# Perform jobs for testing
$app->minion->perform_jobs;
=head1 METHODS
L<Mojolicious::Plugin::Minion> inherits all methods from
L<Mojolicious::Plugin> and implements the following new ones.
=head2 register
$plugin->register(Mojolicious->new, {Pg => 'postgresql://postgres@/test'});
Register plugin in L<Mojolicious> application.
=head1 SEE ALSO
L<Minion>, L<Mojolicious::Guides>, L<http://mojolicious.org>.
=cut
|