diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-01-21 18:44:08 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-01-21 18:44:08 +0100 |
commit | e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804 (patch) | |
tree | 5a69b0efe6c0b7ab88925d3d066271ec40845e23 /modulemanager | |
parent | fead8af2b767cb5591536a3c98babf6b35194a66 (diff) | |
parent | 7dd831383f7506e49f568d0684ee1ecb1f5dc90f (diff) |
Merge insp20
Diffstat (limited to 'modulemanager')
-rwxr-xr-x | modulemanager | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/modulemanager b/modulemanager index 9e4670de8..86f9ca0c4 100755 --- a/modulemanager +++ b/modulemanager @@ -24,14 +24,14 @@ use warnings FATAL => qw(all); use make::utilities; -if (!module_installed("LWP::Simple")) -{ - die "Your system is missing the LWP::Simple Perl module!"; -} +BEGIN { + unless (module_installed("LWP::Simple")) { + die "Your system is missing the LWP::Simple Perl module!"; + } + unless (module_installed("Crypt::SSLeay") || module_installed("IO::Socket::SSL")) { + die "Your system is missing the Crypt::SSLeay or IO::Socket::SSL Perl modules!"; + } -if (!module_installed("Crypt::SSLeay") && !module_installed("IO::Socket::SSL")) -{ - die "Your system is missing the Crypt::SSLeay or IO::Socket::SSL Perl modules!"; } use File::Basename; @@ -56,15 +56,20 @@ sub parse_url; # retrieve and parse entries from sources.list sub parse_url { - my $src = shift; + chomp(my $src = shift); return if $url_seen{$src}; $url_seen{$src}++; - my $doc = get($src); - die "Could not retrieve $_" unless defined $doc; + my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); + my $response = $ua->get($src); + + unless ($response->is_success) { + my $err = $response->message; + die "Could not retrieve $src: $err"; + } my $mod; - for (split /\n+/, $doc) { + for (split /\n+/, $response->decoded_content) { s/^\s+//; # ignore whitespace at start next if /^#/; if (/^module (\S+) (\S+) (\S+)/) { @@ -257,7 +262,7 @@ sub resolve_deps { } } -my $action = $#ARGV > 0 ? lc shift @ARGV : 'help'; +my $action = $#ARGV >= 0 ? lc shift @ARGV : 'help'; if ($action eq 'install') { for my $mod (@ARGV) { |