Skip to content

Commit

Permalink
Download: make it a CAF::ObjectText instance
Browse files Browse the repository at this point in the history
  • Loading branch information
stdweird committed Dec 12, 2015
1 parent b001e2c commit b72a514
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/main/perl/Download.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use warnings;

# For re-export only
use CAF::Download::URL qw(set_url_defaults);
use parent qw(CAF::Object Exporter CAF::Download::URL CAF::Download::Retrieve);
use parent qw(CAF::ObjectText Exporter CAF::Download::URL CAF::Download::Retrieve);

use Readonly;
use LC::Exception qw (SUCCESS);
Expand Down Expand Up @@ -38,17 +38,6 @@ Readonly::Hash my %DOWNLOAD_AUTHENTICATION => {
x509 => [qw(lwp)],
};

# Handle failures. Stores the error message and log it verbose and
# returns undef. All failures should use 'return $self->fail("message");'.
# No error logging should occur in this module.
sub fail
{
my ($self, @messages) = @_;
$self->{fail} = join('', @messages);
$self->verbose("FAIL: ", $self->{fail});
return;
}

# Disclaimer: inspired by
# NCM::Component::download (15.8)
# EDG::WP4::CCM::Fetch (15.8)
Expand Down Expand Up @@ -130,7 +119,7 @@ sub _initialize

%opts = () if !%opts;

$self->{log} = $opts{log} if $opts{log};
$self->_initialize_textopts(%opts);

$self->{setup} = (! defined($opts{setup}) || $opts{setup}) ? 1 : 0;
$self->{cleanup} = (! defined($opts{cleanup}) || $opts{cleanup}) ? 1 : 0;
Expand Down
1 change: 1 addition & 0 deletions src/test/perl/download.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Test all methods for C<CAF::Download>

my $d = CAF::Download->new(["http://localhost"], log => $obj);
isa_ok($d, 'CAF::Download', 'is a CAF::Download instance');
isa_ok($d, 'CAF::ObjectText', 'CAF::Download is a CAF::ObjectText instance');
is($d->{setup}, 1, "default setup is 1");
is($d->{cleanup}, 1, "default cleanup is 1");
ok(! exists($d->{destination}), 'no destination specified, attribute does not exist');
Expand Down

0 comments on commit b72a514

Please sign in to comment.