File Coverage

lib/App/MtAws/QueueJob/DownloadSingle.pm
Criterion Covered Total %
statement 28 28 100.0
branch 14 14 100.0
condition n/a
subroutine 8 8 100.0
pod 0 2 0.0
total 50 52 96.1


line stmt bran cond sub pod time code
1             # mt-aws-glacier - Amazon Glacier sync client
2             # Copyright (C) 2012-2014 Victor Efimov
3             # http://mt-aws.com (also http://vs-dev.com) vs@vs-dev.com
4             # License: GPLv3
5             #
6             # This file is part of "mt-aws-glacier"
7             #
8             # mt-aws-glacier is free software: you can redistribute it and/or modify
9             # it under the terms of the GNU General Public License as published by
10             # the Free Software Foundation, either version 3 of the License, or
11             # (at your option) any later version.
12             #
13             # mt-aws-glacier is distributed in the hope that it will be useful,
14             # but WITHOUT ANY WARRANTY; without even the implied warranty of
15             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16             # GNU General Public License for more details.
17             #
18             # You should have received a copy of the GNU General Public License
19             # along with this program. If not, see <http://www.gnu.org/licenses/>.
20              
21             package App::MtAws::QueueJob::DownloadSingle;
22              
23             our $VERSION = '1.114_2';
24              
25 9     9   669 use strict;
  9         11  
  9         231  
26 9     9   34 use warnings;
  9         11  
  9         199  
27 9     9   32 use Carp;
  9         9  
  9         419  
28              
29 9     9   42 use App::MtAws::QueueJobResult;
  9         17  
  9         517  
30 9     9   67 use base 'App::MtAws::QueueJob';
  9         12  
  9         2568  
31              
32             sub init
33             {
34 122     122 0 129 my ($self) = @_;
35 122 100       395 $self->{archive_id}||confess;
36 121 100       298 defined($self->{relfilename})||confess;
37 120 100       262 defined($self->{filename})||confess;
38 119 100       265 $self->{jobid}||confess;
39 118 100       274 $self->{size}||confess;
40 117 100       252 defined($self->{mtime})||confess;
41 116 100       238 $self->{treehash}||confess;
42 115         222 $self->enter('download');
43             }
44              
45             sub on_download
46             {
47 111     111 0 124 my ($self) = @_;
48             return state "wait", task "retrieval_download_job", {
49 777         1604 (map { $_ => $self->{$_} } qw/archive_id relfilename filename jobid size mtime treehash/),
50             } => sub {
51 111     111   252 state("done")
52             }
53 111         225 }
54              
55             1;