Re: APR::Request::Apache2 param() method
removing the enctype makes no difference. still encounter the same error. i also added discard_request_body... the code now reads: my $req = APR::Request::Apache2->handle($r); $r->discard_request_body; my($arg_status,$body_status) = $req->param_status(); $r->log->debug("Parsing returned $arg_status, $body_status"); #this is line 43 if($r->method_number() == Apache2::Const::M_POST) { my $ps = $req->param(); foreach my $k (keys(%$ps)) { $r->log->warn("Got $k => " . $ps->{$k}); } ## verify that we got an alert id my $alert_id = $req->param('alerts_id'); my $alert_email = $req->param('alerts_email'); $r->log->debug(" Checking params"); if(!$alert_id) { $r->log->warn("no alert id given"); here's the output in the error log: [Wed Jan 31 13:17:32 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(17): [client 127.0.0.1] using mod_perl handler for removing mailing list, referer: http://lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] Use of uninitialized value in concatenation (.) or string at /Users/ dviner/Documents/amb/dev/aboutmybaby/AMB/Handlers/MailingList/ Remove.pm line 43. [Wed Jan 31 13:17:32 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(43): [client 127.0.0.1] Parsing returned Missing input data, , referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Wed Jan 31 13:17:32 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(55): [client 127.0.0.1] Checking params, referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Wed Jan 31 13:17:32 2007] [warn] [client 127.0.0.1] no alert id given, referer: http://lalala.aboutmybaby.localhost/mailing_list/ [EMAIL PROTECTED] I also tried to verify my sanity by using CGI.pm to print out what the parameters are that are received... here's that output and code: [Wed Jan 31 13:23:30 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(18): [client 127.0.0.1] using mod_perl handler for removing mailing list, referer: http://lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] Use of uninitialized value in concatenation (.) or string at /Users/ dviner/Documents/amb/dev/aboutmybaby/AMB/Handlers/MailingList/ Remove.pm line 44. [Wed Jan 31 13:23:30 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(44): [client 127.0.0.1] Parsing returned Missing input data, , referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] Got [CGI] alerts_id => 44524, referer: http://lalala.aboutmybaby.localhost/ mailing_list/[EMAIL PROTECTED] [Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] Got [CGI] alerts_email => [EMAIL PROTECTED], referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] Got [CGI] submit => Remove, referer: http://lalala.aboutmybaby.localhost/mailing_list/ [EMAIL PROTECTED] [Wed Jan 31 13:23:30 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(62): [client 127.0.0.1] Checking params, referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] no alert id given, referer: http://lalala.aboutmybaby.localhost/mailing_list/ [EMAIL PROTECTED] CODE: my $req = APR::Request::Apache2->handle($r); $r->discard_request_body; my($arg_status,$body_status) = $req->param_status(); $r->log->debug("Parsing returned $arg_status, $body_status"); if($r->method_number() == Apache2::Const::M_POST) { my $ps = $req->param(); foreach my $k (keys(%$ps)) { $r->log->warn("Got [APR::Request::Apache2] $k => " . $ps- >{$k}); } my $cgi = CGI->new($r); my $pscgi = $cgi->Vars(); foreach my $k (keys(%$pscgi)) { $r->log->warn("Got [CGI] $k => " . $pscgi->{$k}); } ## verify that we got an alert id my $alert_id = $req->param('alerts_id'); my $alert_email = $req->param('alerts_email'); $r->log->debug(" Checking params"); if(!$alert_id) { $r->log->warn("no alert id given"); How is it that CGI.pm finds the parameter and APR::Re
APR::Request::Apache2 param() method
Hi, I am having a strange problem with APR::Request::Apache2 and the param () method. When I send a POST from Firefox, my code works perfectly. When I send a POST from Safari or Windows/IE, my code fails. Here is the HTML which displays the form to send: method="post" enctype="multipart/form-data"> value="[EMAIL PROTECTED]"> onclick="document.location='/'; return false;"> Here is the Perl code which handles this request: my $req = APR::Request::Apache2->handle($r); my($arg_status,$body_status) = $req->param_status(); $r->log->debug("Parsing returned $arg_status, $body_status"); if($r->method_number() == Apache2::Const::M_POST) { my $ps = $req->param(); foreach my $k (keys(%$ps)) { $r->log->warn("Got $k => " . $ps->{$k}); } ## verify that we got an alert id my $alert_id = $req->param('alerts_id'); my $alert_email = $req->param('alerts_email'); $r->log->debug(" Checking params"); if(!$alert_id) { $r->log->warn("no alert id given"); return show_form($class, $r, $Site, $req, "Must pass a properly formatted alert id"); } $r->log->debug("Have a good alert id"); Again, when Firefox sumbits this request, the code works perfectly... Here's a snippet from the error log showing the statements: [Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(17): [client 127.0.0.1] using mod_perl handler for removing mailing list, referer: http://lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] Use of uninitialized value in concatenation (.) or string at /Users/ dviner/Documents/amb/dev/aboutmybaby/AMB/Handlers/MailingList/ Remove.pm line 43. [Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(43): [client 127.0.0.1] Parsing returned Missing input data, , referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Tue Jan 30 12:33:43 2007] [debug] filter.c(269): [client 127.0.0.1] prefetching 65536 bytes, referer: http://lalala.aboutmybaby.localhost/ mailing_list/[EMAIL PROTECTED] [Tue Jan 30 12:33:43 2007] [warn] [client 127.0.0.1] Got alerts_id => 44505, referer: http://lalala.aboutmybaby.localhost/mailing_list/ [EMAIL PROTECTED] [Tue Jan 30 12:33:43 2007] [warn] [client 127.0.0.1] Got alerts_email => [EMAIL PROTECTED], referer: http://lalala.aboutmybaby.localhost/ mailing_list/[EMAIL PROTECTED] [Tue Jan 30 12:33:43 2007] [warn] [client 127.0.0.1] Got submit => Remove, referer: http://lalala.aboutmybaby.localhost/mailing_list/ [EMAIL PROTECTED] [Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(55): [client 127.0.0.1] Checking params, referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(61): [client 127.0.0.1] Have a good alert id, referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] Here's the same request made from Mac/Safari or Win/IE [Tue Jan 30 12:34:49 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(17): [client 127.0.0.1] using mod_perl handler for removing mailing list, referer: http://lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] Use of uninitialized value in concatenation (.) or string at /Users/ dviner/Documents/amb/dev/aboutmybaby/AMB/Handlers/MailingList/ Remove.pm line 43. [Tue Jan 30 12:34:49 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(43): [client 127.0.0.1] Parsing returned Missing input data, , referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Tue Jan 30 12:34:49 2007] [debug] filter.c(269): [client 127.0.0.1] prefetching 65536 bytes, referer: http://lalala.aboutmybaby.localhost/ mailing_list/[EMAIL PROTECTED] [Tue Jan 30 12:34:49 2007] [debug] /Users/dviner/Documents/amb/dev/ aboutmybaby/AMB/Handlers/MailingList/Remove.pm(55): [client 127.0.0.1] Checking params, referer: http:// lalala.aboutmybaby.localhost/mailing_list/remove? [EMAIL PROTECTED] [Tue Jan 30 12:34:49 2007] [warn] [client 127.0.0.1] no alert id given, referer: http://lalala.aboutmybaby.localhost/mailing_list/ [EMAIL PROTECTED] Any suggestions on how to fix this? My platform is: [Tue Jan 30 12:33:01 2007] [notice] Apache/2.0.58 (Unix) PHP/5.1.4 DAV/2 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.8.8 configured -- resuming normal operations thanks dave
Re: Problems with apreq2 on OS X
this might be a dumb question, but have you checked that the apreq module is loaded? LoadModule apreq_modulemodules/mod_apreq2.so ? dave On Oct 29, 2006, at 12:23 PM, Patrick Galbraith wrote: Fred Moyer wrote: Patrick Galbraith wrote: Fred, Ok: I have this failure on 1. OS X 2. Suse 10.0 amd 64 3. Suse 9.3 intel 32 Has anyone addressed this? This is what I would call severely broke. I would prefer not to use CGI. After this week, I think maybe the universe is telling me to learn PHP after all these years of being a perl developer. The short answer would be to use an earlier release of libapreq - this only happened to me with the latest release. Or use CGI for now until it's fixed. There's nothing wrong with using CGI while this bug gets worked out, the api is the same for the most part. libapreq is still in a development version, and chances are that your application will not bottleneck on CGI. If you go to PHP, you should not expect a trouble free life :) I don't have anything against PHP, but it has it's own set of problems. With development in any language, you need to make sure that you keep a tight hold on your versions. Using the latest version of something isn't always the best move, as experience has taught me. It's nice to try it out and report bugs back, and helpful to the development of the project, but use the version that works for you. I've dug around a bit in the code trying to resolve this issue, but it's a bit above my head right now. Fred, I know, I'm just frustrated and venting after losing many hours of dev time. The reason CGI won't work in my case is I've written all this code as a handler and putting into CGI seems like it'd be a lot of work. Maybe not, I'm not sure what I would have to change since I rely so much on the request object. When you say to use an earlier version of libapreq, do you mean version 1.0? That won't work because all the linux dists I deal with are ones with pre-packaged mod_perl2 and apache2 (but haven't been able to get apreq to compile correctly against those pre- package versions, trying everything from source). Thanks for your replies! Patrick Patrick Fred Moyer wrote: Patrick Galbraith wrote: [Sun Oct 29 12:38:27 2006] [notice] Apache/2.2.3 (Unix) mod_ssl/ 2.2.3 OpenSSL/0.9.8d DAV/2 mod_perl/2.0.2 Perl/v5.8.8 configured -- resuming normal operations dyld: lazy symbol binding failed: Symbol not found: _apreq_handle_apache2 Referenced from: /opt/local/lib/perl5/vendor_perl/5.8.8/ darwin-2level/auto/APR/Request/Apache2/Apache2.bundle Expected in: dynamic lookup dyld: Symbol not found: _apreq_handle_apache2 Referenced from: /opt/local/lib/perl5/vendor_perl/5.8.8/ darwin-2level/auto/APR/Request/Apache2/Apache2.bundle Expected in: dynamic lookup [Sun Oct 29 12:38:38 2006] [notice] child pid 11206 exit signal Trace/BPT trap (5) OS X version: Darwin radha.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/ RELEASE_I386 i386 i386 Not sure what this is. Anyone encountered this before? I ran into this also, same platform. I have been digging around a bit to see if I can resolve it but no luck so far - my foo in this area isn't quite where it needs to be. This works fine for me on Linux though. Also, is there a way to have access to things like $rec->param without having to use Apache2::Request/libapreq2? I ask this in case there is no solution for getting this to work, as well as on linux distributions I cannot get libapreq2 working. You can use CGI. Are you hitting this same issue on Linux?