Ongoing LWP impass... advise please?

Discussion in 'Perl Misc' started by at, Dec 6, 2003.

  1. at

    at Guest

    Thanks for the several responses I have received all of which I have
    tried. However, the program seems to fail during executing always at
    the same spot. I receive NO error messages, but I receive NO response
    other than the html page being sent to me again. I would assume this
    indicates an error so retry.

    Here is my code snippet. How would one go about altering this to
    make it work?
    ======================================================

    my $URL2="https://www.blah.com";
    my $DATA="";
    my $fname="filename";

    open(TFH,"<$filename.in") or die "Cannot Open $filename.in\n";
    while(<TFH>) {
    $DATA.=chomp($_);
    }
    close(TFH);

    $REQ= POST $URL2,
    [ NETCONNECT_TRANSACTION => $DATA ];

    $RSP=$UA->request($REQ, "$filename.out");


    =====================================================

    The above request should be a rather normal POST request and the
    content should be the descriptor "NETCONNECT_TRANSACTION=" and the
    field $DATA is the entire contents of an XML formatted file. There is
    also a cookie automatically attached to the request that was
    previously retrieved after authenticating with the remote host.

    The request line should write the response received from the remote
    host into the file $filename.out.

    Any guidance, advise, code revisions, etc. will be G-R-E-A-T-L-Y
    appreciated.

    Bob
     
    at, Dec 6, 2003
    #1
    1. Advertising

  2. at <R.MariottiFinancialDataCorp.com> wrote:

    > How would one go about altering this to
    > make it work?


    > while(<TFH>) {
    > $DATA.=chomp($_);
    > }



    Have a look at what value you have collected at this point:

    print $DATA;

    Then you might figure that you're goint to have to read the
    documentation for the function that you are using to find out
    what it returns:

    perldoc -f chomp

    The 2nd sentence should help solve your problem.



    To my mind, the return value from chomp() is not useful, so it is a
    red flag to me when I see the return value from chomp being used. :)


    > Any guidance, advise, code revisions, etc. will be G-R-E-A-T-L-Y
    > appreciated.



    Use the docs, Luke.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Dec 6, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry
    Replies:
    1
    Views:
    327
    Rajeev Soni
    Aug 4, 2003
  2. Jay
    Replies:
    1
    Views:
    298
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. Lloyd Sheen

    OT: Ongoing story of Silverlight

    Lloyd Sheen, Mar 4, 2009, in forum: ASP .Net
    Replies:
    2
    Views:
    325
    Lloyd Sheen
    Mar 4, 2009
  4. Kenneth McDonald
    Replies:
    1
    Views:
    81
    Michael Guterl
    Oct 22, 2008
  5. Niall
    Replies:
    3
    Views:
    140
Loading...

Share This Page