Reputation: 121
I have a Mojolicious application. It runs under Starman very well, but I want to run it from command line
with parameters.
Command
./myapp get /
works as well, but
./myapp get /?param=val
does not work as there is not any parameter.
Can you help me?
Upvotes: 1
Views: 943
Reputation: 891
This is works.
# Automatically enables "strict", "warnings", "utf8" and Perl 5.10 features
use Mojolicious::Lite;
# Route with placeholder
get '/' => sub {
my $self = shift;
my $param = $self->param('param') // 'qwerty';
$self->render(text => "Hello from $param.");
};
# Start the Mojolicious command system
app->start;
Use it something like this:
perl 1.pl get /?param=111
Upvotes: 2