1CGI::Application::PlugiUns:e:rReCdoinrtercitb(u3t)ed PerClGID:o:cAupmpelnitcaattiioonn::Plugin::Redirect(3)
2
3
4

NAME

6       CGI::Application::Plugin::Redirect - Easy external redirects in
7       CGI::Application
8

SYNOPSIS

10        package My::App;
11
12        use CGI::Application::Plugin::Redirect;
13
14        sub cgiapp_prerun {
15            my $self = shift;
16
17            if ( << not logged in >> ) {
18                return $self->redirect('login.html');
19            }
20        }
21
22        sub byebye {
23            my $self = shift;
24
25            return $self->redirect('http://www.example.com/', '301 Moved Permanently');
26        }
27

DESCRIPTION

29       This plugin provides an easy way to do external redirects in
30       CGI::Application.  You don't have to worry about setting headers or
31       worrying about return types, as that is all handled for you.
32
33       "redirect" does an external redirect, which means that the browser will
34       receive a command to load a new page, and a fresh request will come in.
35       If you just want to display the results of another runmode within the
36       same module, then it is often sufficient to use the "forward" method in
37       CGI::Application::Plugin::Forward instead.
38

METHODS

40   redirect($url, $status)
41       Interupt the current request, and redirect to an external URL.  If you
42       happen to be inside a prerun method when you call this, the current
43       runmode will automatically be short circuited so that it will not
44       execute.  As soon as all prerun method have finished, the redirect will
45       happen without the runmode being executed.
46
47       The $status paramater is optional as the CGI module will default to
48       something suitable.
49
50         return $self->redirect('http://www.example.com/');
51
52         - or -
53
54         return $self->redirect('http://www.example.com/', '301 Moved Permanently');
55

SEE ALSO

57       CGI::Application, CGI::Application::Plugin::Forward, perl(1)
58

AUTHOR

60       Cees Hek <ceeshek@gmail.com>
61
63       Copyright (c) 2005, Cees Hek.  All rights reserved.
64
65       This module is free software; you can redistribute it and/or modify it
66       under the same terms as Perl itself.
67

DISCLAIMER OF WARRANTY

69       BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
70       FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
71       WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
72       PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
73       EITHER EXPRESSED ORIMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
74       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
75       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
76       YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
77       NECESSARY SERVICING, REPAIR, OR CORRECTION.
78
79       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
80       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
81       REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
82       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
83       CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
84       SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
85       RENDERED INACCURATE OR LOSSESSUSTAINED BY YOU OR THIRD PARTIES OR A
86       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
87       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
88       DAMAGES.
89
90
91
92perl v5.32.1                      2021-01-C2G6I::Application::Plugin::Redirect(3)
Impressum