Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners Cgi > mod_perl newbie...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 1428 of 1490
Post > Topic >>

mod_perl newbie gotcha

by evillen@[EMAIL PROTECTED] (Evillen@[EMAIL PROTECTED] ) Nov 20, 2007 at 10:32 AM

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 re****ts 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'}<p>",
$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'}<p>";

foreach my $val($q->param()){print "$val: ",$q->param($val);}

print "<p><a href='pass_from.cgi'>Return</a>";

$q->delete('id');

print $q->end_html;
exit();
 




 4 Posts in Topic:
mod_perl newbie gotcha
evillen@[EMAIL PROTECTED]  2007-11-20 10:32:24 
Re: mod_perl newbie gotcha
noreply@[EMAIL PROTECTED]  2007-11-21 00:52:03 
Re: mod_perl newbie gotcha
evillen@[EMAIL PROTECTED]  2007-11-22 01:39:38 
Re: mod_perl newbie gotcha
noreply@[EMAIL PROTECTED]  2007-11-22 17:35:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 11:14:48 CDT 2008.