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

Hello:
I am trying to do a HTTP Post to a web site. When I do the POST
I get the following error message:
Not an ARRAY reference at C:/Perl/site/lib/URI/_query.pm line 35.
Here is the code:
my $response1 = $browser1->post( 'http://localhost/cgi-bin/fdata.pl', [ 'K.Page.B' => "doxxx",, 'KRI' => "0,0,1", 'X' => $blk, 'X3.SRC' => $blk, 'K.Loop.B' => "rsld,rsul", 'AA.SRC' => $blk, 'CP.SRC' => $blk, 'SD.SRC' => ",,", 'D1.SRC' => ",", 'K.Page.E' => "doxxx", 'K.Section.B' => "rsld,rsul,rsul", 'K.Section.E' => "rsld,rsul,rsul", 'X1.SRC' => "'", 'XA.SRC' => $blk, 'SD.DT' => ",,", 'OSD' => ",", 'XA.DT' => $blk, 'SD.TM' => ",,", 'OSD-QTY' => ",", 'XA.TM' => $blk, 'K.Loop.E' => "rsld,rsul", 'S.Continue.x' => "12", 'S.Continue.y' => "16", 'AB.SRC' => ",", 'X9.SRC' => ",", ], ); die "Error: ", $response1->status_line unless $response1->is_success;
Can some one help me as to why I am getting this error.
Thanks for your Help in advance.

Replies are listed 'Best First'.
Re: HTTP POST Using LWP::UserAgent
by saintmike (Vicar) on Mar 16, 2004 at 19:53 UTC
    I presume you've obtained $browser1 by saying something like
    use LWP::UserAgent; my $browser1 = LWP::UserAgent->new();

    If so, works for me. Which version of LWP::UserAgent are you using?

      Yes I am obtaining $browser1 from LWP::UserAgent.
      The version is:# $Id: UserAgent.pm,v 2.23 2003/10/26 15:38:08 gisle Exp $
Re: HTTP POST Using LWP::UserAgent
by developer (Novice) on Mar 16, 2004 at 20:18 UTC
    Sorry, Missed part of the code last time. Here is the full code
    my $browser1 = LWP::UserAgent->new; my $response1 = $browser1->post( 'http://localhost/cgi-bin/viewformdata.pl', [ 'K.Page.B' => "do214",, 'KRI' => "0,0,1", 'X' => $blk, 'X3.SRC' => $blk, 'K.Loop.B' => "rsld,rsul", 'AA.SRC' => $blk, 'CP.SRC' => $blk, 'SD.SRC' => ",,", 'D1.SRC' => ",", 'K.Page.E' => "do214", 'K.Section.B' => "rsld,rsul,rsul", 'K.Section.E' => "rsld,rsul,rsul", 'X1.SRC' => "'", 'XA.SRC' => $blk, 'SD.DT' => ",,", 'OSD' => ",", 'XA.DT' => $blk, 'SD.TM' => ",,", 'OSD-QTY' => ",", 'XA.TM' => $blk, 'K.Loop.E' => "rsld,rsul", 'S.Continue.x' => "12", 'S.Continue.y' => "16", 'AB.SRC' => ",", 'X9.SRC' => ",", 'KWFSTATE' => $KWFSTATE, 'pro' => $pro, 'eq-num' => $eqnum, 'AA.DT' => $AA_DT, 'AA.TM' => $AA_TM, 'X3.DT' => , 'X3.TM' => , 'CP.DT' => $CP_DT, 'CP.TM' => $CP_TM, 'AB.DT' => $AB_DT, 'AB.TM' => $AB_TM, 'X9.DT' => , 'X9.TM' => , 'X1.DT' => $X1_DT, 'X1.TM' => $X1_TM, 'D1.DT' => $D1_TM, 'D1.TM' => $D1_TM, ], ); die "Error: ", $response1->status_line unless $response1->is_success; $r1=$response1->content; print "$r1 \n";
    Thanks
      For one thing, you list has the wrong number of commas. This will mess up the alignment and what items are named and which are values.
      'K.Page.B' => "do214",, 'X3.DT' => , 'X3.TM' => ,
      The empty value is also not good because Perl empty list elements completely. Use the empty string if you an empty value.