Peter Scott wrote:
On Tue, 02 May 2006 13:06:56 +0200, luis wrote:

the following code is part of a bigger script. I would like to know if
there is a way to print out or store into a file all the messages that
my script sends to the server, I mean, the full header and data parts
sent to the server, in order to debug my application.


use LWP::Debug qw(+conns);


my $ua = LWP::UserAgent->new;

[snip]

Storing into a file is preferred over printing out to screen.


Internally it is hardwired to print to STDERR.  You could override the
private method _log() that contains that code, but that would be rude. Better to redirect STDERR before your LWP calls.


Thank you, Peter. That would be great if I knew where to read the STDERR since I'm running my script from the command line in an out-of-the-box CentOS linux installation. The only thing I got was outputting something like:

# LWP::DebugFile logging to lwp_44585fc2_30a3.log
# Time now: {1146642370} = Wed May  3 09:46:10 2006
LWP::UserAgent::new: ()
LWP::MediaTypes::read_media_types: Reading media types from /usr/lib/perl5/site_perl/5.8.0/LWP/media.types LWP::MediaTypes::read_media_types: Reading media types from /usr/lib/perl5/vendor_perl/5.8.0/LWP/media.types
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: POST http://localhost:8080/webct/systemIntegrationApi.dowebct
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 33 bytes
LWP::Protocol::collect: read 44 bytes
LWP::UserAgent::request: Simple response: OK


using LWP::DebugFile but I was expecting to get the full messages that the script is sending to the server in the other side, something like:

POST /webct/systemIntegrationApi.dowebct HTTP/1.0
Content-length: 1253
Content-type: multipart/form-data;

boundary=WebCT_Enterprise_API_Boundary
--WebCT_Enterprise_API_Boundary
Content-Disposition: form-data; name="ACTION"

import
--WebCT_Enterprise_API_Boundary
Content-Disposition: form-data; name="OPTION"
.......... etc.

Can I get this using LWP::Debug? If so, with which options? And even one more question, where it the STDERR stored when the script is ran in command mode?.

Sorry for so many questions.

Best regards,
Luis A. Martínez

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to