Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script which uses the CGI module to handle a simple login form. This had been working fine but it has just stopped working. By not working I mean that the script can no longer access values from the form.
Nothing in the scripts has changed and as far as I know nothing in the environment has changed either.
Has anyone seen this behaviour before??

Replies are listed 'Best First'.
Re: Cannot access form values
by InfiniteLoop (Hermit) on Apr 04, 2005 at 11:23 UTC
    No I have'nt come across such issue, but it is worth dumping the environment variables and checking the form field names. Ofcourse you can use Data::Dumper
      use CGI qw/:standard/;
      .....
      my $query = new CGI;
      IMPACT::Common::logRecord(Dumper($query));
      .....
      

      the above code returns the following:

      $VAR1 = bless( {
              '.charset' => 'ISO-8859-1',
              '.parameters' => [],
              '.fieldnames' => {}
              }, 'CGI' );
      
        use CGI qw/:standard/;
        Why are you importing ':standard'? Do not mix OO and function style use of CGI.pm. You're probably using the param function, and it's already read the form data.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Cannot access form values
by nite_man (Deacon) on Apr 04, 2005 at 11:24 UTC
    Could you give us more details - piece of code, server environment etc?

    ---
    Michael Stepanov aka nite_man

    It's only my opinion and it doesn't have pretensions of absoluteness!

      We use apache on a linux box.
      Some code:
      use CGI qw/:standard/;
      ....
      my $query = new CGI;
      .........
      $username = $query->param("username");
      IMPACT::Common::logRecord("Attempted login for $username");
      ........
      
      The last line of code above prints the following in the logfile:
      "Attempted login for "
      
Re: Cannot access form values
by jbrugger (Parson) on Apr 04, 2005 at 12:04 UTC
    Is it on your own server, or is it hosted somewere else, and who maintains the server.
    Is mod perl suddenly enabeled
    is there any error message
    is httpd changed, is there another server-change, are there rights changed, is it on windows or linux?
    Prehaps you should read How (not) to ask a question before posting a question like this.
    There may be a lot reasons why it's not working, an answer can't be given this way
    anyway, a script won't just stop working without any change, there definately happened somehing.

    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
      It is on our own linux server which is maintained by my boss.
      mod perl has not been suddenly enabled.
      no error messages are generated.
      There have been no changes that i know of.
      
      Finally, apologies for my initial message. It is a little vague.
        Seems nothing wrong with your script, seems that no info was send to the script. I'd say there is soming wrong in either your html, or something in apache was altered.
        I still do think you should be far more expressive if you want a solution, show us some html (form methods, submit methods (via JavaScript?) info about your apache setup etc.
        as stated before, something won't just stop working like this.
        I'd even try to check a system with a program like checkrootkit to see if the system is still 'clean'

        "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.