# Perl Script to resume download

**URL:** <https://community.unix.com/t/perl-script-to-resume-download/229502>\
**Category:** Shell Programming and Scripting\
**Created:** [January 29, 2009, 1:02am UTC](https://community.unix.com/t/perl-script-to-resume-download/229502 "2009-01-29T01:02:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vin\_eme](https://community.unix.com/letter_avatar/vin_eme/32/6_22734026db12803ebb3e059622ac3534.png) [@vin\_eme](https://community.unix.com/u/vin_eme)\
**Post date:** [January 29, 2009, 1:02am UTC](https://community.unix.com/t/perl-script-to-resume-download/229502/1 "2009-01-29T01:02:43Z")

</div>

Hi,

i am looking for a perl script[only] that can resume broken download images from a remote server. Can anyone help me on this.

thanks,  
Vince

---

<div class="post-metadata">

**Author:** ![pludi](https://community.unix.com/user_avatar/community.unix.com/pludi/32/1278_2.png) [@pludi](https://community.unix.com/u/pludi)\
**Post date:** [January 29, 2009, 3:02am UTC](https://community.unix.com/t/perl-script-to-resume-download/229502/2 "2009-01-29T03:02:10Z")

</div>

First, why Perl only? wget does supply that functionality pretty nicely.  
Second, since I know of no Perl Module to do that by default, it would work something like this:

- Find out how much has already been downloaded
- Create an HTTP Request (e.g. HTTP::Request from the LWP Bundle)
- Set an additional header for the offset ([Content-Range](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16) as specified in [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616.html)). HTTP::Headers from the LWP Bundle can do that.
- Send the request and append the answer to the file.
