Download files using Perl
Posted
by Neeraj
on Stack Overflow
See other posts from Stack Overflow
or by Neeraj
Published on 2010-03-21T12:00:59Z
Indexed on
2010/03/21
12:11 UTC
Read the original article
Hit count: 196
I have a project that depends upon some other binaries to be downloaded from web at install time.For this what i do is:
if ( file-present-in-src/)
# skip that file
else
# use wget to download the file
The problem with this approach is that when I interrupt a download in middle, and do invoke the script next time, the partially downloaded file is also skipped (which is not desired), also I want wget to resume the download of the partially downloaded file.
How should I go about it: Possible Solutions I could think of:
- Let the file to be downloaded to some file say download_tmp. Copy to original file if successful.
- Handle SIG{'INT'} to write proper cleanup code.
But none of these could help resume the partial file download,
Any insights?
© Stack Overflow or respective owner