in reply to WWW::Mechanize Post Method - Help find error

I'm not sure what "javascript monitoring proxy program" you are using, but the output does not look like valid Perl.

Maybe you meant the HTTP::Request constructor method POST, but you don't show any more relevant code. Check the top of your script for a line like use HTTP::Request;. And even then, the generated line should look more like :

$request = HTTP::Request->new( POST => ... );

So to me, it seems like your "javascript monitoring proxy program" doesn't really produce direct Perl code.

Replies are listed 'Best First'.
Re: Re: WWW::Mechanize Post Method - Help find error
by Agyeya (Hermit) on May 18, 2004 at 06:14 UTC
    Thank you for your help, i located the error.
    The code
    $request = new HTTP::Request(POST "http://www.abc.com/ChooseZone.aspx? +type=A" , [ '__EVENTTARGET' => "rdlZone_0", '__EVENTARGUMENT' => "", '__VIEWSTATE' => "dDw0NzUyO", 'rdlZone' => "1", ] );
    has been changed to
    $request = new HTTP::Request('POST'=> "http://www.abc.com/ChooseZone.a +spx? +type=A" , [ '__EVENTTARGET' => "rdlZone_0", '__EVENTARGUMENT' => "", '__VIEWSTATE' => "dDw0NzUyO", 'rdlZone' => "1", ] );
    It was a matter of changing POST to 'POST'=>
    Thank you for your help
      It was a matter of changing POST to 'POST'=>

      For future reference, note that the => operator is just like the comma, except it does automagic quoting of its left-hand-side. This is made exactly for the case you've shown, to eliminate the need for quoting. In other words, your line could be written as:

      $request = new HTTP::Request(POST => "...", [ __EVENTTARGET => "rdlZone_0", __EVENTARGUMENT => "", __VIEWSTATE => "dDw0NzUyO", rdlZone => "1", ] );