CGI.pm problem
Hello, When I try to make a CGI object in my Apache/mod_perl handler a la $q = CGI-new(); The server just don't reply. Actually it works just fine until I try to submit a form, then it just hangs and Apache doesn't send anything back. If I remove this object creation line, then I can submit my form (but then its no use, i can't use the data). What could be the problem? Rgds, Viljo
Re: CGI.pm problem
On Wed, 31 Oct 2001 02:31, you wrote: Hello, When I try to make a CGI object in my Apache/mod_perl handler a la $q = CGI-new(); The server just don't reply. Actually it works just fine until I try to submit a form, then it just hangs and Apache doesn't send anything back. If I remove this object creation line, then I can submit my form (but then its no use, i can't use the data). What could be the problem? What version of CGI.pm are you using? I seem to remember a problem with mod_perl and an older version of CGI.pm where CGI.pm was fooled into thinking it was run in command line mode. If you are seeing the following line in your logs then this is definately the cause of your problem: (offline mode: enter name=value pairs on standard input) To fix this put $CGI::NO_DEBUG=1 near the top of your program or upgrade CGI.pm. Cees ps you should be using Apache::(Request|Cookie) to get your GET/POST/COOKIE parameters, as it is more efficient. ---
Re: CGI.pm problem
Rick Myers [EMAIL PROTECTED] writes: On Aug 29, 2000 at 16:11:39 +0400, Alexei V. Barantsev twiddled the keys to say: Dear mod_perl'ers! I have found strange difference between object and func modes of CGI library. More precisely - I have a problem with Vars function. #use CGI qw(:standard :cgi-lib); CGI::_reset_globals; #my $args = Vars; _reset_globals() is normally called when you create a new CGI object. In this context though, your object lives on between script runs so you have to manually tell CGI to reset it. O-o-ps! Isn't it a good idea to put this tip into documentation - mod_perl traps with functional mode of CGI.pm? -- ab ICQ: 3959207
Migrating from CGI.pm to (...?), was Re: CGI.pm problem
Jeff Beard [EMAIL PROTECTED] writes: There isn't a Vars() function in CGI.pm. If you're looking for the query string try param(). Or if you want to make it a mod_perl program (which is what you would normally discuss on this list) Apache::Request::param(). --Jeff There is such a function, Jeff! Well, could you advice, how to migrate from CGI.pm to Apache or Apache::Request. The matter is that I have used CGI.pm for HTML generation primarily and ready to use something another to analyze request parameters. But I cannot use CGI and e.g Apache::Request simultaneousely - server hangs. Is there some CGI.pm replacement intended only for HTML generation in the same manner (which does nothing with request, especially POST request)? -- ab ICQ: 3959207
Re: Migrating from CGI.pm to (...?), was Re: CGI.pm problem
On 30 Aug 2000, Alexei V. Barantsev wrote: Jeff Beard [EMAIL PROTECTED] writes: There isn't a Vars() function in CGI.pm. If you're looking for the query string try param(). Or if you want to make it a mod_perl program (which is what you would normally discuss on this list) Apache::Request::param(). --Jeff There is such a function, Jeff! Well, could you advice, how to migrate from CGI.pm to Apache or Apache::Request. The matter is that I have used CGI.pm for HTML generation primarily and ready to use something another to analyze request parameters. But I cannot use CGI and e.g Apache::Request simultaneousely - server hangs. Is there some CGI.pm replacement intended only for HTML generation in the same manner (which does nothing with request, especially POST request)? CGI.pm 3.x is supposed to have the args processing and html generation separated. See: http://stein.cshl.org/WWW/software/CGI/cgi_docs.html http://stein.cshl.org/WWW/software/CGI/CGI.pm-3.01.tar.gz (beta) _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: Migrating from CGI.pm to (...?), was Re: CGI.pm problem
Ah, so there is. I grep'd an older version which didn't since I'd never heard of it before. You use Apache::Request to get query parameters the same way you do with CGI.pm's param() method. perldoc Apache::Request. Did you could try just importing the CGI.pm HTML functions? Personally, I prefer Template Toolkit for HTML generation. There are other templating systems too. Search the archives for discussions on the subject. Or as Stas suggested, check out the version 3 beta. I've been using it on my personal web server for a few months with no problems, though I don't use any of the HTML generation features. --Jeff At 10:32 AM 8/30/00 +0400, Alexei V. Barantsev wrote: Jeff Beard [EMAIL PROTECTED] writes: There isn't a Vars() function in CGI.pm. If you're looking for the query string try param(). Or if you want to make it a mod_perl program (which is what you would normally discuss on this list) Apache::Request::param(). --Jeff There is such a function, Jeff! Well, could you advice, how to migrate from CGI.pm to Apache or Apache::Request. The matter is that I have used CGI.pm for HTML generation primarily and ready to use something another to analyze request parameters. But I cannot use CGI and e.g Apache::Request simultaneousely - server hangs. Is there some CGI.pm replacement intended only for HTML generation in the same manner (which does nothing with request, especially POST request)? -- ab ICQ: 3959207 Jeff Beard __ Web:www.cyberxape.com Email: jeff at cyberxape dot com Location: Boulder, Colorado, USA
Re: CGI.pm problem
There isn't a Vars() function in CGI.pm. If you're looking for the query string try param(). Or if you want to make it a mod_perl program (which is what you would normally discuss on this list) Apache::Request::param(). --Jeff At 04:11 PM 8/29/00 +0400, Alexei V. Barantsev wrote: Dear mod_perl'ers! I have found strange difference between object and func modes of CGI library. More precisely - I have a problem with Vars function. Let me show an example: #!/usr/bin/perl -w use Data::Dumper; use CGI; my $q = new CGI; my $args = $q-Vars; #use CGI qw(:standard :cgi-lib); #my $args = Vars; print header, start_html, p( Dumper( $args ) ), start_form( -method = "POST", -action = "/~barancev/cgi-perl/test.pl" ), textfield( -name = "name", -size = 50 ), submit( -name = "submit", -value = "Submit" ), submit( -name = "cancel", -value = "Cancel" ), end_form, end_html; All works ok, when I click button I see what button was pressed and what string was entered. But if I try functional way instead (commented in example) I see that $args is empty! In single-process mode (httpd -X) both examples work right. Why? (BTW, both examples was tried on clean, just started Apache) -- ab ICQ: 3959207 Jeff Beard __ Web:www.cyberxape.com Email: jeff at cyberxape dot com Location: Boulder, Colorado, USA
Re: CGI.pm problem
On Aug 29, 2000 at 16:11:39 +0400, Alexei V. Barantsev twiddled the keys to say: Dear mod_perl'ers! I have found strange difference between object and func modes of CGI library. More precisely - I have a problem with Vars function. #use CGI qw(:standard :cgi-lib); CGI::_reset_globals; #my $args = Vars; _reset_globals() is normally called when you create a new CGI object. In this context though, your object lives on between script runs so you have to manually tell CGI to reset it. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.