in reply to Re^5: Form Data inaccessible after establishing session
in thread Form Data inaccessible after establishing session

Thanks for the help, I have now figured out how to get around the problem. I figured it out while testing with CGI::Simple. While using CGI::Simple did work, I found out that CGI.pm also works fine if you pass the CGI object into the creation of the CGI::Session object.

Before

my $session = CGI::Session->new(undef, undef, {Directory=>'e:\tmp'});

After

my $session = CGI::Session->new(undef, $cgi, {Directory=>'e:\tmp'});

When using the new code, my form data is always available in my CGI object and my CGI::Session object.

Thanks again! (Complete testing code below)

use strict; use warnings; use CGI; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; use CGI::Session ( '-ip_match' ); my $cgi = CGI->new(); my @array = $cgi->param(); print "CGI Form Data-->", "@array ", $cgi->param("environment"), "<br> +"; print $cgi->Dump; my $session = CGI::Session->new(undef, $cgi, {Directory=>'e:\tmp'}); print $cgi->escapeHTML( Data::Dumper::Dumper( $cgi ) ), "<br><br><br>" +; print $cgi->escapeHTML( Data::Dumper::Dumper( $session ) ), "<br>"; print <<HTML_BLOCK; <body> <form name='loginform' method='post' action='1.pl'> <input type='hidden' name='form' value='login'> <table> <tr> <td> UserName: </td> <td> <input type='text' name='username'> < +/td> </tr> <tr> <td> Password: </td> <td> <input type='password' name='password +'> </td> </tr> <tr> <td> Environment: </td> <td> <select size=1 name='environment'> <option value="env1">env1</option> <option value="env2">env2</option> </select> </td> </tr> <tr> <td colspan=2 style='text-align=center'> <input type='submit' name='submit' val +ue='Submit'> <input type='reset' name='reset' value +='Reset'> </td> </tr> </table> </form> </body> HTML_BLOCK

Replies are listed 'Best First'.
Re^7: Form Data inaccessible after establishing session
by Anonymous Monk on Apr 23, 2011 at 07:37 UTC
    Wait a minute, what do you have?
    $ pmvers CGI CGI::Simple CGI::Session CGI: 3.52 CGI::Simple: 1.113 CGI::Session: 4.43
      E:\Program Files (x86)>ppm list --matching CGI --fields version name: version CGI: 3.51 CGI-Session: 4.42 CGI-Simple: 1.113 (3 packages installed matching 'CGI')
      E:\Program Files (x86)>ppm search "CGI" 180: CGI-Session 4.42 204: CGI-Simple 1.113 249: CGI.pm 3.52

      I tried upgrading to the CGI.pm 3.52 code, however, the issue persisted after the version upgrade. Additionally, as you can see, PPM does not have a version 4.43 code for CGI::Session.