use libapreq2 to read POST params

Dave Viner <[email protected]>
Newsgroups gmane.comp.apache.apreq
Message-ID <[email protected]>
Hi,
I'm trying to use libapreq2 to read some parameters submitted via  
POST, but I'm having trouble.  Should I use $req->body($myparam) ? or  
$req->param($myparam)?


My code looks like this:

         $r->log->debug("Testing param");
         my ($md5, $entered);
         eval { $md5 = $req->param('cv'); } ;
         if($@)
         {
             use Data::Dumper;
             $r->log->error("ACK: no cv param: " . $@->strerror() . "  
-- " . Dumper($@));
             return $class->handle_get($r, $Site, $req,
                                     'The code entered was not  
valid.<br>Please try again.');
         }
         $r->log->debug("For cv got... $md5");


The error log shows the following:

[Fri Sep 22 10:59:56 2006] [debug] /Users/dviner/Documents/amb/dev/ 
aboutmybaby/AMB/Handlers/GuestbookSign.pm(57): [client 127.0.0.1]  
Testing param
[Fri Sep 22 10:59:56 2006] [debug] filter.c(269): [client 127.0.0.1]  
prefetching 65536 bytes
Use of uninitialized value in concatenation (.) or string at /Users/ 
dviner/Documents/amb/dev/aboutmybaby/AMB/Handlers/GuestbookSign.pm  
line 67.
[Fri Sep 22 10:59:56 2006] [debug] /Users/dviner/Documents/amb/dev/ 
aboutmybaby/AMB/Handlers/GuestbookSign.pm(67): [client 127.0.0.1] For  
cv got...


The request I sent is as follows:

$ cat sign.params | lwp-request -m POST -SUsue "http:// 
lalala.aboutmybaby.localhost/guestbook/sign"
$ cat sign.params
gbentry_from=hithere&gbentry_body=foobar&cv=1111111&cg=abcdef

$

Here are the details of my installation:

[Fri Sep 22 10:59:55 2006] [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 for your help.
Dave Viner
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.