One of the tasks in a Minion job queue I am using needs user and password.
I found a good description on how to pass parameters to a Mojo app here so I went about it like this:
package Minion::Command::minion::secure_worker;
use Mojo::Base 'Minion::Command::minion::worker';
use Mojo::Util 'getopt';
sub run {
my ( $self, @args ) = @_;
my $worker = $self->app->minion->worker;
my $status = $worker->status;
getopt \@args,
'U|username=s' => \my $username,
'P|password=s' => \my $password;
$self->app->credentials->{username} = $username;
$self->app->credentials->{password} = $password;
return $self->SUPER::run;
}
1
However when I try to pass options that were in the original worker command - such as -j
I get:
Unknown option: j
Why is that? It looks like subclassing a command doesn't work, or that getopt slurps everything?