Re: Post data with Apache2::Request
On Sat, May 24, 2008 at 4:57 PM, kropotkin <[EMAIL PROTECTED]> wrote: > > Hi > > I am trying to obtain POST data from a form. > > I have these lines: > > my $req = Apache2::Request->new($r); > my $email = $req->body('email'); my $email = $req->params('email'); > > My form contains a field called 'email'. > > However no data. > > The line: print $req->body_status(); outputs 'SUCCESS' seeming to indicate > a) that $req as an instance of Apache2::Request and b) that the object > thinks it has got some data? > > I have tired sending the data by GET and using : my $email = > $req->param('email') but there was no data there either. > > I don't want to use CGI.pm if possible > > with thanks > > Kropotkin > -- > View this message in context: > http://www.nabble.com/Post-data-with-Apache2%3A%3ARequest-tp17452698p17452698.html > Sent from the mod_perl - General mailing list archive at Nabble.com. > > -- ~Tyler
Re: Post data with Apache2::Request
Hi Tyler The cpan docs say $req->body('field_name') for POST data and seem to imply $req->param('field_name') for GET data. Neither work. I reinstalled libapreq . I had the same problems with Apache::Request. Could never get POST data out of that though I could get GET data. Looks like back to CGI.pm. regards Kropotkin Tyler Gee wrote: > > On Sat, May 24, 2008 at 4:57 PM, kropotkin <[EMAIL PROTECTED]> > wrote: >> >> Hi >> >> I am trying to obtain POST data from a form. >> >> I have these lines: >> >> my $req = Apache2::Request->new($r); >> my $email = $req->body('email'); > > my $email = $req->params('email'); > >> >> My form contains a field called 'email'. >> >> However no data. >> >> The line: print $req->body_status(); outputs 'SUCCESS' seeming to >> indicate >> a) that $req as an instance of Apache2::Request and b) that the object >> thinks it has got some data? >> >> I have tired sending the data by GET and using : my $email = >> $req->param('email') but there was no data there either. >> >> I don't want to use CGI.pm if possible >> >> with thanks >> >> Kropotkin >> -- >> View this message in context: >> http://www.nabble.com/Post-data-with-Apache2%3A%3ARequest-tp17452698p17452698.html >> Sent from the mod_perl - General mailing list archive at Nabble.com. >> >> > > > > -- > ~Tyler > > -- View this message in context: http://www.nabble.com/Post-data-with-Apache2%3A%3ARequest-tp17452698p17461443.html Sent from the mod_perl - General mailing list archive at Nabble.com.
Trouble with mod_perl, Archive::Zip and taint mode
[Please CC me on all replies] So, I am writing some simple code to allow a user to upload his own photo galleries. The section of code giving me problems is this: my $scratch_dir = $gallery_dir . "/scratch"; my $zipper = Archive::Zip->new(); my $zip_stat = $zipper->read($destfile); if ($zip_stat == Archive::Zip::AZ_OK) { $zipper->extractTree('.', $scratch_dir); print "Extracted archive contents into target directory.\n"; } else { print "Unable to operate on the uploaded archive file. Please fix the problem and upload again.\n"; } When I call extractTree() in the manner shown above, I get the "Extracted archive..." output, but nothing is actually extracted. If I change the call to extractTree() with no arguments, I get a 500 error and this in my Apache log: [Sun May 25 08:57:35 2008] [error] [asp] [11570] [error] error executing code for include /var/www/templates/Photo_page_edit.tmpl: Insecure dependency in open while running setgid at /usr/lib/perl/5.8/IO/File.pm line 70. <--> ; compiled to SCALAR(0x91f6f24) at /usr/share/perl5/Apache/ASP/Response.pm line 844. <--> , /usr/share/perl5/Apache/ASP.pm line 1521 If I try this, I also get the same taint error: my $scratch_dir = $gallery_dir . "/scratch"; my $zipper = Archive::Zip->new(); my $zip_stat = $zipper->read($destfile); if ($zip_stat == Archive::Zip::AZ_OK) { my @members = $zipper->memberNames(); foreach my $fn (@members) { $fn =~ /(.*)/; $fn = $1; $zipper->extractMember($n); } print "Extracted archive contents into target directory.\n"; } else { print "Unable to operate on the uploaded archive file. Please fix the problem and upload again.\n"; } I have also tried adding in gratuitous untaintings, but to no avail. Has anyone been able to make Archive::Zip work? If so, how? I am very close to just using system() to call /usr/bin/unzip, but that is not very portable. Regards, -Roberto P.S. The server running this site is Debian Etch, so unfortunately, I cannot use Archive::Extract which is included in Perl 5.10.0. -- Roberto C. Sánchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: Post data with Apache2::Request
Hi Tyler Solved! I didn't and should have said I am using Mason. It looks like Mason gobbled up the POST data. (This must an example of the problem I see mentioned that the POST data can only be read once). I can then get the POST data from a Mason variable %ARGS. regards Justin kropotkin wrote: > > Hi Tyler > > The cpan docs say $req->body('field_name') for POST data and seem to imply > $req->param('field_name') for GET data. Neither work. > > I reinstalled libapreq . > > I had the same problems with Apache::Request. Could never get POST data > out of that though I could get GET data. > > Looks like back to CGI.pm. > > > > regards > > Kropotkin > > > Tyler Gee wrote: >> >> On Sat, May 24, 2008 at 4:57 PM, kropotkin <[EMAIL PROTECTED]> >> wrote: >>> >>> Hi >>> >>> I am trying to obtain POST data from a form. >>> >>> I have these lines: >>> >>> my $req = Apache2::Request->new($r); >>> my $email = $req->body('email'); >> >> my $email = $req->params('email'); >> >>> >>> My form contains a field called 'email'. >>> >>> However no data. >>> >>> The line: print $req->body_status(); outputs 'SUCCESS' seeming to >>> indicate >>> a) that $req as an instance of Apache2::Request and b) that the object >>> thinks it has got some data? >>> >>> I have tired sending the data by GET and using : my $email = >>> $req->param('email') but there was no data there either. >>> >>> I don't want to use CGI.pm if possible >>> >>> with thanks >>> >>> Kropotkin >>> -- >>> View this message in context: >>> http://www.nabble.com/Post-data-with-Apache2%3A%3ARequest-tp17452698p17452698.html >>> Sent from the mod_perl - General mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> ~Tyler >> >> > > -- View this message in context: http://www.nabble.com/Post-data-with-Apache2%3A%3ARequest-tp17452698p17461631.html Sent from the mod_perl - General mailing list archive at Nabble.com.
Re: Post data with Apache2::Request
kropotkin wrote: Hi I am trying to obtain POST data from a form. Try LWP::UserAgent to post forms instead. It's quite easy to use.
Re: Post data with Apache2::Request
On May 26, 2008, at 9:40 AM, Foo JH wrote: kropotkin wrote: Hi I am trying to obtain POST data from a form. Try LWP::UserAgent to post forms instead. It's quite easy to use. Read the subject again. Epic fail at reading comprehension. He's not trying to post forms anywhere, he's trying to read post form data using Apache2::Request, whole different end of the spectrum there sonny :) smime.p7s Description: S/MIME cryptographic signature
Apache2::Request error ...
Hi, I get the following error when trying to run my script ... /usr/bin/perl: symbol lookup error: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/APR/Request/Apache2/Apache2.so: undefined symbol: modperl_xs_sv2request_rec, Here is my script... #!/usr/bin/perl use warnings; use strict; #use CGI qw(:standard); #use Apache::Request (); use Apache2::Request; my $r = shift; my $req = Apache2::Request->new($r); ... , I learned that "my $req = Apache2::Request->new($r);" cause such error but couldn't find the solution. Please advise. Thanks PA -- View this message in context: http://www.nabble.com/Apache2%3A%3ARequest-error-...-tp17465813p17465813.html Sent from the mod_perl - General mailing list archive at Nabble.com.