Thursday, December 20, 2001, 9:34:29 PM, Jeff Self wrote: > I'm trying to automate a process of grabbing a file from a website. I > could do a system call and use wget but I would like it to be as > portable as possible. Here's my function I've written so far:
> sub get_games_file() { > »·······use LWP::Simple; > »······· > »·······my $URL = 'http://www.mcn.net/~kenpom/cbbgames.txt'; > »·······my $gamefile = get($URL) or die "Failed to get " .. $URL .": $!"; > } > This doesn't give me any errors but it doesn't save the file to my > computer. Am I on the right track or is there another function that > works better? do you try and save it somewhere afterwards? if there's no more code than what you posted then it'll download the file and then just ignore it. if you want to save it to a file you could use: getstore($url, $file) Gets a document identified by a URL and stores it in the file. The return value is the HTTP response code. $! won't be set if get() fails. if you want to get interesting error codes while using get() then your needs are no longer "Simple", and you'll have to start looking at LWP::UserAgent et al. -- Best Regards, Daniel [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]