Re: How to parse after reading POST data in mod_perl 2 ?

2002-11-04 Thread Sumitro Chowdhury
Thanks Philippe for the tip.
After looking at Apache2::Apache::compat and some
input from Randy Kobes, I came up with the following
package called getform.pm which gets the form data
into a hash without using Apache::compat.

(Hope it will help some newbie !!):

package ModPerl::getform;

use strict;
use Apache::Reload;

sub handler {
my $r = shift;

$r-content_type('text/html');

my $form_input;

# Read in the form - data 
# 
   
$r-read($form_input,$r-headers_in-{'Content-length'});
$r-setup_client_block;
print Error unless $r-should_client_block;
   
$r-get_client_block($form_input,$r-headers_in-{'Content-length'});

my @args = map {
   
s/%([0-9a-fA-F]{2})/pack(c,hex($1))/ge;
s/\+/ /g;
$_;
   } split /[=;]/, $form_input, -1;

my %input;
while (my ($name,$value) = splice @args,0,2) {
push @{$input{$name}}, $value;
}

$r-send_http_header;
print BRI got the following info:BRBR;

foreach (keys %input) {
print $_ = @{$input{$_}}BR;
}


return Apache::OK;
}
1;

Thanks guys,
This is a great list.

Sumitro Chowdhury.

--- Philippe M. Chiasson [EMAIL PROTECTED] wrote:
 On Fri, 2002-11-01 at 03:41, Sumitro Chowdhury
 wrote:
  Hi all,
  Please help ...
  
  Using  Apache/2.0.43 (Unix) mod_perl/1.99_07-dev
  Perl/v5.8.0 .
  
  I read in POST data from Form using
  $r-read($buff,$r-headers_in-{'Content-length'})
  
  Since I donot use Apache::compat, what API methods
 are
  available to parse this string data ? ( possibly
  convert it to a hash )
 
 There isn't anything readily avaliabe for the
 moment, but take a look
 at parse_args() in Apache::compat for a good working
 example.
 
 
 


 Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/


__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/



How to parse after reading POST data in mod_perl 2 ?

2002-10-31 Thread Sumitro Chowdhury
Hi all,
Please help ...

Using  Apache/2.0.43 (Unix) mod_perl/1.99_07-dev
Perl/v5.8.0 .

I read in POST data from Form using
$r-read($buff,$r-headers_in-{'Content-length'})

Since I donot use Apache::compat, what API methods are
available to parse this string data ? ( possibly
convert it to a hash )

Cannot use params() from Apache::Request since I have
not installed mod_perl 1.

Thanks,
Sumitro Chowdhury

__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/