Clear questions and runnable code
get the best and fastest answer
Failure to redirect when my CGI::Application powered site is used under mod_perl2by skx (Parson)
|on Aug 14, 2008 at 20:42 UTC||Need Help??|
skx has asked for the
wisdom of the Perl Monks concerning the following question:
I've got an issue with redirection failing from my CGI::Application when running under mod_perl.
I'm very new to mod_perl so I could well believe that I've done something wrong. My configuration for Apache2 + mod_perl is very minimal:
This works for most of my application, and appears to improve response time significantly - however there is one problem. My redirections, as coded in the CGI::Application do not work.
I've pared this down to a minimal clone of my code - I have a base class implementing a redirect method, and I have a subclass which uses that to redirect a few times.
In plain CGI-mode this works. In mod_perl it gives me the following output direct to my browser:
redirect<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>200 OK</title> </head><body> <h1>OK</h1> <p>The document has moved <a href="http://example.com/">here</a>.</p> <hr> <address>Apache/2.2.9 (Debian) PHP/5.2.6-2+b1 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g mod_musicindex/1.2.2 mod_perl/2.0.4 Perl/v5.10.0 Server at mail-scanning.com Port 80</address> </body></html>
Now here is my example code which exhibits the same problem:
Any clues, or tips are most welcome. Any more details I can provide just ask - this is all running upon libapache2-mod-perl2, as included in Debian.
Update: - Strangly using CGI::Application::Plugin::Redirect works correctly if I change my code: