Martin R Morales wrote:
>
> Martin R Morales wrote:
> >
> > I have been reading up on LWP::UserAgent and HTTP::Request of the LWP
> > package. This is good stuff.
> > But I am still confused about a couple of things. Here is ther
> > senario. I have a file I want to download from
> > my server and I can do that with LWP. But what I'm confused on is One:
> > how do I save the file to a certain
> > directory once I have started the GET process; insted of it dumping to
> > stdout? The other part I am unclear on
> > is this: if the site does not contain the file I am looking to GET,
> > then I should receive the standard web response
> > of 'file does not exist' or other responses like 'forbidden', etc. I
> > am unclear how to 'log' these responses or redirect
> > them to a file for later examination insted of dumping to stdout.
> >
> > Thus far I have a script that will do what I want it to do, but now I
> > need to understand how to save my file(s)
> > to disk insted of dumping to stdout, and logging the responses to a
> > file for review. Let me know if I have made myself unclear. I look
> > forward to hearing from
> > you all soon with your input and ideas.
> >
>
> I have figured out how to save to file ..
> I have to open a file handle .. duh? yeah .. i know.
> Okay, but I would still like suggestions on saving my http responses to
> file .. like a log file
> of what the script was trying to do on execute.

Hi Martin.

There are a few different ways you could be using the LWP library.
I don't understand how you got the output 'dumping to STDOUT' in the
first place. Have you check out the LWP::UserAgent::mirror method?

As for logging, what you're likely to want to do is

  print $request->as_string;

and

  print $response->status_line

where $request and $response are and HTTP::Request object and
an HTTP::Response object, respectively. More than that I can't
help without knowing what you want and what you're tried.

HTH,

Rob





-- 
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