NAME
Mojolicious::Plugin::AutoParams - Send captured placeholder values as parameters for routes.
SYNOPSIS
use Mojolicious::Lite;
use experimental 'signatures';
plugin 'auto_params';
get '/hello/:name' => sub ($c,$name) { $c->render(text => "hi, $name") }
OR
use Mojolicious::Lite;
plugin 'auto_params', { named => 1 }
get '/hello/:name' => sub {
my $c = shift;
my %args = @_;
$c->render(text => "hi, $args{name}")
};
OR
use Mojolicious::Lite;
plugin 'auto_params', { named => '_' }
get '/hello/:name' => sub { shift->render(text => "hi, $_->{name}") }
DESCRIPTION
This module automatically sends placeholders as a list of parameters to routes.
By default it uses positional parameters, but it will optionally send a hash if the "named" option is set to 1.
Setting 'named' to '_' will set the local $_ to a hashref of the placeholders.
AUTHOR
Brian Duggan <bduggan@matatu.org>