On Nov 21, 2007 9:54 AM, David Eisner <[EMAIL PROTECTED]> wrote:
> httpd segfaults when I access this CGI, on the second or subsequent
> access (but not the first) after restarting the server:
>
> use CGI qw/:standard/;
> use strict;
>
> my $q = CGI->new();
> handle_response();
> exit(0);
>
>
> sub handle_response() {
> $q->redirect( "http://slashdot.org" );
> }
You're creating a closure. The CGI object created on the first
request gets stuck in your handle_response sub and tries to use a
reference to an old Apache2::RequestRec object.
You need to pass $q to your sub every time. You can't just access it
directly from the enclosing scope.
- Perrin