> -----Original Message-----
> From: Steven Bach [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, December 29, 2001 7:28 PM
> To: [EMAIL PROTECTED]
> Subject: open URL as stream with LWP?
> 
> 
> Is there a way to open a URL with LWP so that it becomes 
> something like 
> a filehandle so that I can do a "while (<URL>)" on it?  This would be 
> really handy, but I can't sort out how to do it.
> 
> The code I am working on originally opened a file, and used a 
> filehandle 
> to do its thing.  Replacing the filehandle would keep things 
> so simple. 
>   I can already opening a pipe to wget or curl, which is what I am 
> doing, but I would like to use LWP so that things would be 
> more portable.

You can do something along the lines of the following to get
line-by-line processing of a response:

 #!/usr/bin/perl

 use LWP::Simple;

 for (split /\n/, get("http://www.yahoo.com";)) {
     print $_, "\n";
 }

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to