Ongoing LWP impass... advise please?

A

at

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
 
T

Tad McClellan

at said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top