in reply to Check remote file for size?

Hi Mosley,

You could try something like this to check for the size of the file before beginning download.
#!/usr/bin/perl -w use strict; use LWP::Simple; my $url="http://localhost/index.html"; my $MAX_SIZE=50_000; my ($content_type, $document_length, $modified_time, $expires, $server +)= head($url); if ($document_length>$MAX_SIZE){ print "TooBig, Ignoring\n" } else { my $dl=get($url); print $dl; };

To Parse the html, I would suggest using HTML::Parser, but you don't wan't to use a module. Why constrain yourself so?
Anyway, Hope this helps,

thinker

Replies are listed 'Best First'.
Re: Re: Check remote file for size?
by Mosley (Novice) on Oct 13, 2001 at 15:15 UTC
    Thanks Paul and Thinker. I will use the modules. I was using ">" to write with, but some reason it wasn't clobbering it, after thinking about the temp file being write protected, I think Win32 still thought the script was running. Your help was just what I needed! This place is about 500% better than Usenet!