| 1 | package Yukki::Web::Controller::Redirect; | ||
| 2 | { | ||
| 3 | $Yukki::Web::Controller::Redirect::VERSION = '0.140290'; | ||
| 4 | } | ||
| 5 | use 5.12.1; | ||
| 6 | use Moose; | ||
| 7 | |||
| 8 | use Yukki::Error qw( http_throw ); | ||
| 9 | |||
| 10 | # ABSTRACT: Simple controller for handling internal redirects | ||
| 11 | |||
| 12 | |||
| 13 | sub fire { | ||
| 14 | my ($self, $ctx) = @_; | ||
| 15 | |||
| 16 | my $redirect = $ctx->request->path_parameters->{redirect}; | ||
| 17 | |||
| 18 | http_throw("no redirect URL named") unless $redirect; | ||
| 19 | |||
| 20 | http_throw("Go to $redirect.", { | ||
| 21 | status => 'MovedPermanently', | ||
| 22 | location => $redirect, | ||
| 23 | }); | ||
| 24 | } | ||
| 25 | |||
| 26 | 1; | ||
| 27 | |||
| 28 | __END__ |