mod_perl newbie gotcha
Looking for help from anyone with mod_perl experience - I have been caught by a classic newbie gotcha... I think. Running Activestate Perl v5.8.8 for MSWin32, Apache 2.0 for Win32 I believe I have correctly installed mod_perl as $ENV{'MOD_PERL'} correctly reports the version "mod_perl/2.0.3" Two simple example CGI scripts - *The first sends the contents and name of textfield to the second. *The second script should then print the value of the textfield to the screen. The problem is that after the first successful send/receive, all subsequent executions contain the same initial data: the parameters never get reset with 'newer' data. I understand that mod_perl is pretty fussy about closing down assignments and undefining variables, working with 'strict' and avoiding Globals. I would appreciate anyone pointing out the (hopefully) obvious mistake in my code below - or any guidance at all. Cheers NJH pass_from.cgi -- #!c:/perl/bin/perl.exe use warnings; use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use DBI; my $q = new CGI; print $q->header, $q->start_html(-title=>'Pass From'), "mod_perl - $ENV{'MOD_PERL'}", $q->start_multipart_form(-action=>"pass_to.cgi"), $q->textfield(-name=>'id', -size=>10), $q->submit(), $q->end_form(); $q->delete('id'); print $q->end_html; exit(); pass_to.cgi -- #!c:/perl/bin/perl.exe use warnings; use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use DBI; my $q = new CGI; print $q->header, $q->start_html(-title=>'Pass To'), "mod_perl - $ENV{'MOD_PERL'}"; foreach my $val($q->param()){print "$val: ",$q->param($val);} print "Return"; $q->delete('id'); print $q->end_html; exit(); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: mod_perl newbie gotcha
On Nov 20, 11:52 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: > [EMAIL PROTECTED] wrote: > > The problem is that after the first successful send/receive, all > > subsequent executions contain the same initial data: the parameters > > never get reset with 'newer' data. > > I wasn't able to reproduce the described problem. > > -- > Gunnar Hjalmarsson > Email:http://www.gunnar.cc/cgi-bin/contact.pl Hi Gunnar Are you saying that the code worked as expected? If so this implies that the configuration of my particular setup is the problem... any ideas? Anyone? Thanks NJH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
How to send arguments with a redirect?
Hi I have the following two scripts test.cgi & displaytest.cgi test.cgi is intended to redirect itself to displaytest.cgi and send some arguments. The problem I am having is that I can never get the arguments successfully sent! Redirect without arguments works fine - but the various approached I've tried to send arguments all fail. I would really appreciate some help with this - I'm sure/hope it's a simple syntax issue Thanks NJH test.cgi - #!c:/perl/bin/perl.exe use strict; use warnings; use CGI; my $q = new CGI; my %args = ( 'nev' => 'hi', 'hod' => 'ho' ); print $q->redirect(-url=>'http://pubswww.kl.imgtec.org:8080/cgi-bin/ displaytest.cgi'); # No arguments works print $q->redirect(-url=>'http://pubswww.kl.imgtec.org:8080/cgi-bin/ displaytest.cgi', \%args); # This fails print $q->redirect # # This fails too! ( -url=>'http://pubswww.kl.imgtec.org:8080/cgi-bin/ displaytest.cgi', -nph=>1, { 'never' => 'hi', 'happen' => 'ho' } ); print "Content-Type: text/html\n\n", "The redirect seems to have failed."; --- displaytest.cgi --- #!c:/perl/bin/perl.exe use warnings; use strict; use diagnostics; use CGI; use CGI::Carp qw(fatalsToBrowser); use DBI; my $q = new CGI; print $q->header(), $q->start_html(), 'Test redirection'; print "Args: ", $q->param(), ""; foreach my $param($q->param()) { print "Initial: $param, Value: ",$q->param($param),""; } $q->end_html; exit(); -- To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org For additional commands, e-mail: beginners-cgi-h...@perl.org http://learn.perl.org/