On Wed, 1 Sep 2004, Tim Musson wrote:
My MUA believes you used to write the following on Tuesday, August 31, 2004 at 3:20:50 PM.
Yep, I also noticed Net::HTTP. Any reason I should use one over the other?
CD> I mean really, how much simpler can it be than "get($url)" ?
Thanks Chris, I agree, LWP is much simpler. Here is what I am going to use. Any other suggestions on cleaning it up?
,----- | my $URL = "http://localhost/nvh.csv"; | | use LWP::Simple; | my $content = get($URL); | | my @lines = split(/\n/, $content); | | foreach my $line (@lines) { | # do stuff, for example... | print "$line\n"; | } `-----
No, that doesn't look bad.
The only thing I can suggest is to poke around the other methods that are provided by LWP::Simple -- some of them may be able to make work easier for you:
getprint($url); # print $url source to STDOUT getstore($url, $file); # store $url to $file mirror($url, $file); # store $url to $file if it has changed # since the last time you accessed it
Also, the LWP suite includes some optional command line tools that may be worth looking at:
lwp-download - Fetch large files from the web lwp-mirror - Simple mirror utility lwp-request - Simple command line user agent lwp-rget - Retrieve web documents recursively
These programs are all written in Perl, so examining their source might give you ideas for the kinds of things that can be done.
-- Chris Devers [EMAIL PROTECTED] http://devers.homeip.net:8080/blog/
np: 'The Greatest Phone Message of All Time' by Jonathan Goldstein from 'This American Life: Crimebusters and Crossed Wires'
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>