in reply to cgi->vars() unexpected results

<thinking_cap on>
What is "binary rubbish" and what did you expect? Consider
perl - 1=1 2=2 1=3 1=5 use CGI; use Data::Dumper; local $Data::Dumper::Useqq=1; local $Data::Dumper::Indent=1; print Dumper( scalar CGI->new->Vars ),$/; __END__ $VAR1 = { 1 => "1\0003\0005", 2 => 2 };
That is what I expected because that's what the docs say to expect (the CGI and the Data::Dumper docs).
</thinking_cap>

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.

Replies are listed 'Best First'.
Re: Re: cgi->vars() unexpected results
by Gerard (Pilgrim) on Apr 22, 2004 at 06:21 UTC
    lol, ok. When the request method is post or get I would expect to see a list of value pairs much like what you have in your reply. This is what would normally happen, and was happening previously.

    Now the output from mode code snippet is
    $var1 { 'sd*%^$T$Y$^U 56y$%65 5645' => 'r455&^ 57%^& 547 7765 GFGFH +J&*4#$$^%^*&^ &^*%^ &* &* ASEqw ^&*&^ ^GHSRF&I*&^H %^%$% .....
    etc. The sort of thing that you get when you read a binary file in a text editor. Note: I just typed the above garbage as I am no longer at work, and don't have the file here.
    Thanks, Gerard.

    And Thanks for making me laugh, I've had a long day.
      Since I already /msg'd you, this here for posterity.
      • Don't forget to binmode LOG
      • You have to identify when the data is turning to rubbish and if in fact it is being turned to rubbish.
        1. You should verify your browser is sending what it's supposed to be sending.
        2. You should verify your program is receiving what it should be receiving (just binmode STDIN, read off STDIN before CGI.pm has a chance to touch it).
        3. After that you should ensure that CGI.pm is doing the right thing and that Data::Dumper (don't forget the Useqq option) is doing the right thing
      If applying binmode and Useqq does not solve your problem, my guess is that either your browser is sending weird stuff (likely depending on browser), or your apache is somehow mangling the input (anything could happen I guess).

      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.