Skip to content

Instantly share code, notes, and snippets.

@sshaw
Created March 6, 2012 07:41
Show Gist options
  • Select an option

  • Save sshaw/1984738 to your computer and use it in GitHub Desktop.

Select an option

Save sshaw/1984738 to your computer and use it in GitHub Desktop.
CGI::Expand in Mojolicious::Controller
use Mojo::Base 'Mojolicious';
use CGI::Expand;
sub startup
{
my $self = shift;
$self->hook(before_dispatch => sub {
my $c = shift;
my $hash = CGI::Expand->expand_hash($c->req->params->to_hash);
$c->param($_ => $hash->{$_}) for keys %$hash;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment