From 11093bd5e435f766d1d401e60336a625226fd891 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 30 Dec 2010 16:21:34 +0100 Subject: [PATCH] =?utf8?q?Controller-Base:=20Methode=20f=C3=BCr=20HTTP-Red?= =?utf8?q?irect=20implementiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Base.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index c655e72e2..a2a380b93 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -4,6 +4,10 @@ use parent qw(Rose::Object); use List::Util qw(first); +# +# public/helper functions +# + sub parse_html_template { my $self = shift; my $name = shift; @@ -26,6 +30,17 @@ sub url_for { return "controller.pl?${query}"; } +sub redirect_to { + my $self = shift; + my $url = $self->url_for(@_); + + print $::cgi->redirect($url); +} + +# +# private functions -- for use in Base only +# + sub _run_action { my $self = shift; my $action = "action_" . shift; @@ -169,6 +184,12 @@ Usage from a template might look like this: create new message +=item redirect_to %url_params + +Redirects the browser to a new URL by outputting a HTTP redirect +header. The URL is generated by calling L with +C<%url_params>. + =back =head2 PRIVATE FUNCTIONS -- 2.20.1