Loading ...
Sorry, an error occurred while loading the content.

mod_perl newbie question

Expand Messages
  • hooyar66
    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,
    Message 1 of 1 , Nov 20, 2007
    • 0 Attachment
      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'}<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();
    Your message has been successfully submitted and would be delivered to recipients shortly.