summaryrefslogtreecommitdiff
path: root/lib/SlackBuild/URI.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SlackBuild/URI.pm')
-rw-r--r--lib/SlackBuild/URI.pm29
1 files changed, 9 insertions, 20 deletions
diff --git a/lib/SlackBuild/URI.pm b/lib/SlackBuild/URI.pm
index 21d19f9..91b10c2 100644
--- a/lib/SlackBuild/URI.pm
+++ b/lib/SlackBuild/URI.pm
@@ -7,6 +7,8 @@ use LWP::UserAgent;
use File::Basename;
use File::Spec;
use Log::Log4perl;
+use SlackBuild::Download;
+
# use LWP::Protocol::https;
# use LWP::Protocol::file;
# use LWP::Protocol::ftp;
@@ -72,27 +74,14 @@ sub download {
my $ua = LWP::UserAgent->new();
$ua->agent('Slackbuilder/$SlackBuilder::VERSION');
my $response = $ua->get($self->as_string, ':content_file' => $dst);
- $self->download_response($response);
- return $response->is_success;
-}
-
-sub download_response {
- my $self = shift;
- croak "too many arguments" if (@_ > 1);
- if (my $v = shift) {
- $self->{_response} = $v;
+ my $result = new SlackBuild::Download($self,
+ success => $response->is_success);
+ if ($response->is_success) {
+ $result->content_type($response->content_type);
+ } else {
+ $self->logger->error("$self: " . $response->status_line);
}
- return $self->{_response};
-}
-
-sub download_status {
- my $self = shift;
- return $self->download_response->status_line;
-}
-
-sub downloaded_html {
- my $self = shift;
- return $self->download_response->content_type =~ m{^(?:application/xhtml\+xml|text/(?:css|html))$};
+ return $result;
}
1;

Return to:

Send suggestions and report system problems to the System administrator.