Skip to content

Commit

Permalink
Install LWP::Simple as it's needed
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 9, 2020
1 parent 1e9a7c9 commit 6456cfd
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ use strict;
use warnings;
use ExtUtils::MakeMaker 6.64; # 6.64 for TEST_REQUIRES

my @needfull;

# Install Pre-requisites
BEGIN {
my @modules = (
'LWP::Simple'
);

foreach my $module(@modules) {
eval "use $module";
if($@) {
push @needfull, $module;
}
}

if(scalar(@needfull)) {
my $list = join(' ', @needfull);
if($ENV{'AUTOMATED_TESTING'}) {
die "You need $list to test this package";
}
print "Installing $list\n";
system("cpan -i $list");
}
}

foreach my $module(@needfull) {
my $version;
if($module =~ /(.+)\s(.+)$/) {
$module = $1;
$version = $2;
}
if($module =~ /.+\/(.+)/) {
$module = $1;
}
eval "require $module";
if($@) {
die $@;
}
$module->import();
# if($version && ($module::VERSION < $version)) {
# die "$module: need $version got ", $module::VERSION;
# }
}

if(eval { require Geo::libpostal; }) {
my $v = Geo::libpostal->VERSION;
print "You have Geo::libpostal version $v installed, so Geo-Coder-Free can work better\n";
Expand Down

0 comments on commit 6456cfd

Please sign in to comment.