| 1 | package CPAN::MirrorMerger::Storage::S3::Adapter::NetAmazonS3; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 0 | ▶ | use Class::Accessor::Lite ro => [qw/s3_bucket/], new => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | sub exists :method { | ||
| 8 | my ($self, $key) = @_; | ||
| 9 | my $obj = $self->s3_bucket->object(key => $key); | ||
| 10 | return if $obj->exists(); | ||
| 11 | } | ||
| 12 | |||
| 13 | sub upload { | ||
| 14 | my ($self, $from_path, $save_key) = @_; | ||
| 15 | my $obj = $self->s3_bucket->object(key => $save_key); | ||
| 16 | $obj->put_filename($from_path); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub download { | ||
| 20 | my ($self, $save_key, $tempfile) = @_; | ||
| 21 | my $obj = $self->s3_bucket->object(key => $save_key); | ||
| 22 | return unless $obj->exists(); | ||
| 23 | |||
| 24 | $obj->get_filename("$tempfile"); | ||
| 25 | return $tempfile; | ||
| 26 | } | ||
| 27 | |||
| 28 | 1; | ||
| 29 | __END__ | ||