Hi all,
Emailed Randal about this but he wasn't able to shed much light on it.
I've been developing a site using CGI::Prototype and I seem to have stumbled on some strange behavior.
I'm using mod_perl running on Apache 2.0. I have a handler that checks to see if a user is logged in and redirects them if they are not. The handler calls another function that needs a CGI query object to check some cookies. What's happening is that if a CGI object is created before initialize_CGI is called, and a call is made to $self->CGI later in the prototype flow, all the data from a form using the post method is lost. It seems that the call to CGI::_reset_globals() is to blame. I'm wondering what the reason was for putting that there, and if it's really necessary. If I comment out the _reset_globals() call below, the post data is not lost.
Anybody else run into this problem and have an idea of a workaround? Can't use libapreq2 as I can't get it to install on my machine.
package Extranet::Test; use strict; use warnings; use Apache2::Const qw(OK); use base 'CGI::Prototype'; use Data::Dumper; sub handler { my $r = shift; $r->content_type('text/html'); my $q = CGI->new(); print Dumper $q; Extranet::Test->activate; my $x = CGI->new(); print Dumper $x; return OK; } # dummy call to CGI object sub app_enter { my $self = shift; $self->CGI; } sub initialize_CGI { my $self = shift; $self->reflect->addSlot ([qw(CGI FIELD autoload)] => sub { require CGI; CGI::_reset_globals(); CGI->new; }); } sub template { \ ' <form method=post> <input type=text name=foo value=bar> <input type=text name=baz value=bax> <input type=submit> </form> '; } 1;
In reply to CGI::Prototype form data bug by vbjordan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |