mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Fix various problems with ModuleManager.
- Fix downloading the module list on very new versions of Perl. - Fix an off by one error caused by array sizing starting at -1 instead of 0 like in every single other language (!!). - Fix vague error messages when LWP encounters an error. - Fix LWP::Simple being used before we have checked whether it is available.
This commit is contained in:
parent
457c4f211f
commit
cc6f98c91b
@ -24,15 +24,13 @@ use warnings FATAL => qw(all);
|
|||||||
|
|
||||||
use make::configure;
|
use make::configure;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
if (!module_installed("LWP::Simple"))
|
unless (module_installed("LWP::Simple")) {
|
||||||
{
|
die "Your system is missing the LWP::Simple Perl module!";
|
||||||
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 LWP::Simple;
|
use LWP::Simple;
|
||||||
@ -58,15 +56,20 @@ sub parse_url;
|
|||||||
|
|
||||||
# retrieve and parse entries from sources.list
|
# retrieve and parse entries from sources.list
|
||||||
sub parse_url {
|
sub parse_url {
|
||||||
my $src = shift;
|
chomp(my $src = shift);
|
||||||
return if $url_seen{$src};
|
return if $url_seen{$src};
|
||||||
$url_seen{$src}++;
|
$url_seen{$src}++;
|
||||||
|
|
||||||
my $doc = get($src);
|
my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
|
||||||
die "Could not retrieve $_" unless defined $doc;
|
my $response = $ua->get($src);
|
||||||
|
|
||||||
|
unless ($response->is_success) {
|
||||||
|
my $err = $response->message;
|
||||||
|
die "Could not retrieve $src: $err";
|
||||||
|
}
|
||||||
|
|
||||||
my $mod;
|
my $mod;
|
||||||
for (split /\n+/, $doc) {
|
for (split /\n+/, $response->decoded_content) {
|
||||||
s/^\s+//; # ignore whitespace at start
|
s/^\s+//; # ignore whitespace at start
|
||||||
next if /^#/;
|
next if /^#/;
|
||||||
if (/^module (\S+) (\S+) (\S+)/) {
|
if (/^module (\S+) (\S+) (\S+)/) {
|
||||||
@ -262,7 +265,7 @@ sub resolve_deps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $action = $#ARGV > 0 ? lc shift @ARGV : 'help';
|
my $action = $#ARGV >= 0 ? lc shift @ARGV : 'help';
|
||||||
|
|
||||||
if ($action eq 'install') {
|
if ($action eq 'install') {
|
||||||
for my $mod (@ARGV) {
|
for my $mod (@ARGV) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user