Author image Johan Lindström

NAME

Net::Download::Queue::Download

SYNOPSIS

CLASS DBI STUFF

trigger: before_create

Set domain and bytesContent.

retrieve_current

Return array with all current downloads.

retrieve_downloading

Return array with all downloading downloads.

sql_bytesSumCurrent->select_val

Return total size of current downloads.

sql_bytesSumDownloading->select_val

Return total size of downloading downloads.

METHODS

setDone()

Set the download status to download done ok. Set the bytesDownloaded to bytesContent.

Return 1, die on errors.

setQueued()

Set the download status to queued.

Return 1, die on errors.

setDownloading()

Set the download status to downloading.

Return 1, die on errors.

setBytesDownloaded($bytesTotal)

Set the total number of bytes downloaded in this download.

Return 1, die on errors.

download([$rsStart], [$rsReceived], [$rsCheckCancel])

Attempt to perform download and set the status accordingly.

Perform the download regardless of the current status.

$rsStart, $rsReceived, $rsCheckCancel are sub refs which are called during the download.

  $rsStart->($contentLength)
  Called once.

  $rsReceived->($bytesReceived)
  Called for each chunk downloaded.

  $rsCheckCancel->()
  Called for each chunk. Should return true if the download should be
  cancelled, else false.

Return 1, die on errors.

CLASS METHODS

domainFromUrl($url)

Return the domain part of $url, or "" if none was found.

Die on errors.

bytesContentFromUrl($url, [$urlReferer = ""])

Return the Content-Length of HEAD $url, or 0 if none was found.

Die on errors.

AUTHOR

Johan Lindstrom, <johanl@cpan.org>

BUGS

Please report any bugs or feature requests to bug-net-download-queue@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Download-Queue. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2005 Johan Lindstrom, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.