Skip to content

Instantly share code, notes, and snippets.

@lbalker
Created September 16, 2014 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbalker/329c306a5f98ee32e322 to your computer and use it in GitHub Desktop.
Save lbalker/329c306a5f98ee32e322 to your computer and use it in GitHub Desktop.
my $url = $self->req->headers->referrer;
my $path = Mojo::URL->new($url)->path->to_abs_string;
my $match = Mojolicious::Routes::Match->new(root => $self->app->routes);
$match->match($self => {method => 'GET', path => $path});
if ($match->endpoint) {
my $name = $match->endpoint->name;
$name =~ s/^(en|da)_//;
$url = $self->url_for($name);
}
$self->redirect_to($url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment