Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Download only part of a file from the web

by DigitalKitty (Parson)
on May 10, 2007 at 04:24 UTC ( #614539=note: print w/ replies, xml ) Need Help??


in reply to Download only part of a file from the web

Hi funstence.

I wrote a simple program that you might find useful.

#!/usr/bin/perl use warnings; use strict; use LWP::Simple; my $file = 'test.txt'; my $content = get('http://www. google.com'); open FH, " >", "$file" or die "Error: $!\n"; print FH $content until -s $file >= 25; # I routinely include code to check for a successful closing # of the filehandle since a hardware error could occur. close FH or die "Error: $!\n";


Hope this helps,
~Katie


Comment on Re: Download only part of a file from the web
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://614539]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2015-07-07 01:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls