{
    "mode": "perldoc",
    "parameter": "CGI::Application::Plugin::Redirect",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/CGI%3A%3AApplication%3A%3APlugin%3A%3ARedirect/json",
    "generated": "2026-06-13T06:17:37Z",
    "synopsis": "package My::App;\nuse CGI::Application::Plugin::Redirect;\nsub cgiappprerun {\nmy $self = shift;\nif ( << not logged in >> ) {\nreturn $self->redirect('login.html');\n}\n}\nsub byebye {\nmy $self = shift;\nreturn $self->redirect('http://www.example.com/', '301 Moved Permanently');\n}",
    "sections": {
        "NAME": {
            "content": "CGI::Application::Plugin::Redirect - Easy external redirects in CGI::Application\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "package My::App;\n\nuse CGI::Application::Plugin::Redirect;\n\nsub cgiappprerun {\nmy $self = shift;\n\nif ( << not logged in >> ) {\nreturn $self->redirect('login.html');\n}\n}\n\nsub byebye {\nmy $self = shift;\n\nreturn $self->redirect('http://www.example.com/', '301 Moved Permanently');\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This plugin provides an easy way to do external redirects in CGI::Application. You don't have to\nworry about setting headers or worrying about return types, as that is all handled for you.\n\n\"redirect\" does an external redirect, which means that the browser will receive a command to\nload a new page, and a fresh request will come in. If you just want to display the results of\nanother runmode within the same module, then it is often sufficient to use the \"forward\" method\nin CGI::Application::Plugin::Forward instead.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "redirect($url, $status)\nInterrupt the current request, and redirect to an external URL. If you happen to be inside a\nprerun method when you call this, the current runmode will automatically be short circuited so\nthat it will not execute. As soon as all prerun method have finished, the redirect will happen\nwithout the runmode being executed.\n\nThe $status parameter is optional as the CGI module will default to something suitable.\n\nreturn $self->redirect('http://www.example.com/');\n\n- or -\n\nreturn $self->redirect('http://www.example.com/', '301 Moved Permanently');\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "CGI::Application, CGI::Application::Plugin::Forward, perl(1)\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Cees Hek <ceeshek@gmail.com>\n",
            "subsections": []
        },
        "LICENCE AND COPYRIGHT": {
            "content": "Copyright (c) 2005, Cees Hek. All rights reserved.\n\nThis module is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        },
        "DISCLAIMER OF WARRANTY": {
            "content": "BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE\nEXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER\nEXPRESSED ORIMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nSOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY\nSERVICING, REPAIR, OR CORRECTION.\n\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER,\nOR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE\nLICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT\nLIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSESSUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR\nOTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n",
            "subsections": []
        }
    },
    "summary": "CGI::Application::Plugin::Redirect - Easy external redirects in CGI::Application",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "perl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/perl/1/json"
        }
    ]
}