summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-01-25 12:13:54 +0000
committerSadie Powell <sadie@witchery.services>2021-01-25 12:39:56 +0000
commitf6b861f12d070ba931d829505bfd3229653f5df2 (patch)
treeb043d1e05d9703ab0ec29be91055d793f0fd93d0
parentcc28ba0f2164ea68db1bc373ee06fc58f82c3314 (diff)
Fix unnecessary begin blocks in Perl source files.
-rwxr-xr-xconfigure6
-rwxr-xr-xmake/calcdep.pl13
-rw-r--r--make/common.pm6
-rw-r--r--make/configure.pm6
-rw-r--r--make/console.pm6
-rw-r--r--make/directive.pm6
-rwxr-xr-xmake/unit-cc.pl9
-rwxr-xr-xmodulemanager15
-rwxr-xr-xtools/directive10
-rwxr-xr-xtools/genssl6
-rwxr-xr-xtools/mkdescriptions15
-rwxr-xr-xtools/mkheaders13
-rwxr-xr-xtools/test-build17
-rwxr-xr-xtools/testssl6
-rwxr-xr-xvendor/update10
15 files changed, 35 insertions, 109 deletions
diff --git a/configure b/configure
index 724970cad..029d566af 100755
--- a/configure
+++ b/configure
@@ -30,11 +30,7 @@
#
-BEGIN {
- require 5.10.0;
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/make/calcdep.pl b/make/calcdep.pl
index 59b61e65a..3c02024fa 100755
--- a/make/calcdep.pl
+++ b/make/calcdep.pl
@@ -21,20 +21,13 @@
#
-BEGIN {
- push @INC, $ENV{SOURCEPATH};
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
use strict;
use warnings FATAL => qw(all);
-use File::Basename qw(basename);
+use File::Basename qw(basename dirname);
+use FindBin qw($RealDir);
+use lib dirname $RealDir;
use make::common;
use constant {
diff --git a/make/common.pm b/make/common.pm
index 4d4cd397c..38b77e215 100644
--- a/make/common.pm
+++ b/make/common.pm
@@ -17,13 +17,9 @@
#
-BEGIN {
- require 5.10.0;
-}
-
package make::common;
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/make/configure.pm b/make/configure.pm
index 001de5fc7..dcdcd0aca 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -21,13 +21,9 @@
#
-BEGIN {
- require 5.10.0;
-}
-
package make::configure;
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/make/console.pm b/make/console.pm
index 33ce8f289..278c97d0f 100644
--- a/make/console.pm
+++ b/make/console.pm
@@ -19,11 +19,7 @@
package make::console;
-BEGIN {
- require 5.10.0;
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/make/directive.pm b/make/directive.pm
index 0c789ebf4..25e61160e 100644
--- a/make/directive.pm
+++ b/make/directive.pm
@@ -19,11 +19,7 @@
package make::directive;
-BEGIN {
- require 5.10.0;
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/make/unit-cc.pl b/make/unit-cc.pl
index 8006afe9b..f8991cb67 100755
--- a/make/unit-cc.pl
+++ b/make/unit-cc.pl
@@ -22,16 +22,15 @@
#
-BEGIN {
- push @INC, $ENV{SOURCEPATH};
- require 5.10.0;
-}
-
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
+use File::Basename qw(dirname);
use File::Spec::Functions qw(abs2rel);
+use FindBin qw($RealDir);
+use lib dirname $RealDir;
use make::console;
use make::directive;
diff --git a/modulemanager b/modulemanager
index 1be9f52f9..9bedfcc65 100755
--- a/modulemanager
+++ b/modulemanager
@@ -22,7 +22,6 @@
BEGIN {
- require 5.10.0;
unless (eval "use LWP::Simple; 1") {
die "Your system is missing the LWP::Simple Perl module!";
}
@@ -31,7 +30,7 @@ BEGIN {
}
}
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
@@ -65,7 +64,7 @@ sub parse_url {
return if $url_seen{$src};
$url_seen{$src}++;
- my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
+ my $ua = LWP::UserAgent->new;
my $response = $ua->get($src);
unless ($response->is_success) {
@@ -107,7 +106,7 @@ sub parse_url {
}
# hash of installed module versions from our mini-database, key (m_foobar) to version (00abacca..).
-my %mod_versions = read_config_file '.modulemanager';
+my %mod_versions = read_config_file "$RealDir/.modulemanager";
# useless helper stub
sub getmodversion {
@@ -116,7 +115,7 @@ sub getmodversion {
}
# read in external URL sources
-open SRC, 'sources.list' or die "Could not open sources.list: $!";
+open SRC, "$RealDir/sources.list" or die "Could not open sources.list: $!";
while (<SRC>) {
next if /^\s*#/;
parse_url($_);
@@ -310,7 +309,7 @@ print "Processing changes...\n";
for my $mod (keys %installed) {
next if $todo{$mod};
print "Uninstalling $mod $installed{$mod}\n";
- unlink "src/modules/$mod.cpp";
+ unlink "$RealDir/src/modules/$mod.cpp";
}
my $count = scalar keys %todo;
@@ -334,7 +333,7 @@ for my $mod (sort keys %todo) {
my $response = $ua->get($url);
if ($response->is_success) {
- open(MF, ">src/modules/$mod.cpp") or die "\nFilesystem not writable: $!";
+ open(MF, '>', "$RealDir/src/modules/$mod.cpp") or die "\nFilesystem not writable: $!";
print MF $response->content;
close(MF);
print " - done\n";
@@ -344,6 +343,6 @@ for my $mod (sort keys %todo) {
}
# write database of installed versions
-write_config_file '.modulemanager', %mod_versions;
+write_config_file "$RealDir/.modulemanager", %mod_versions;
print "Finished!\n";
diff --git a/tools/directive b/tools/directive
index 95fe847ac..07d4b09e2 100755
--- a/tools/directive
+++ b/tools/directive
@@ -18,15 +18,7 @@
#
-BEGIN {
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/tools/genssl b/tools/genssl
index 337244292..aab8ce553 100755
--- a/tools/genssl
+++ b/tools/genssl
@@ -19,11 +19,7 @@
#
-BEGIN {
- require 5.10.0;
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/tools/mkdescriptions b/tools/mkdescriptions
index ee29f48e9..bb6f011d8 100755
--- a/tools/mkdescriptions
+++ b/tools/mkdescriptions
@@ -18,15 +18,7 @@
#
-BEGIN {
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
@@ -42,7 +34,7 @@ use lib dirname $RealDir;
use make::common;
use make::console;
-if (scalar @ARGV < 1) {
+unless (scalar @ARGV) {
print_format "<|GREEN Usage:|> $0 <<|UNDERLINE DOCS-SITE|>>\n", *STDERR;
exit 1;
}
@@ -51,7 +43,8 @@ my %version = get_version();
my $docdir = rel2abs catdir $ARGV[0], 'docs', $version{MAJOR}, 'modules';
print_error "unable to find the module directory at $docdir!" unless -d $docdir;
-for my $module (<src/modules/extra/m_*.cpp>, <src/modules/m_*.cpp>, <src/modules/m_*/main.cpp>) {
+my $root = dirname $RealDir;
+for my $module (<$root/src/modules/extra/m_*.cpp>, <$root/src/modules/m_*.cpp>, <$root/src/modules/m_*/main.cpp>) {
print_error "unable to extract module name from $module!" unless $module =~ /m_(\w+)[.\/]/;
my $docfile = catfile $docdir, "$1.md";
print_error "unable to find the module documentation at $docfile!" unless -f $docfile;
diff --git a/tools/mkheaders b/tools/mkheaders
index 0569ec422..0ca593584 100755
--- a/tools/mkheaders
+++ b/tools/mkheaders
@@ -18,15 +18,7 @@
#
-BEGIN {
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
@@ -49,11 +41,12 @@ my @ignored_revisions = (
'f2acdbc3820f0f4f5ef76a0a64e73d2a320df91f', # peavey fixing line endings
);
-my @paths = File::Util->new->list_dir('.' => { recurse => 1 });
+my @paths = File::Util->new->list_dir(dirname($RealDir) => { recurse => 1 });
my @updated;
for my $path (@paths) {
next unless -f $path;
next if $path =~ /\/\./;
+ next if $path =~ /\/build\//;
next if $path =~ /\/vendor\//;
if (system "git ls-files --error-unmatch -- $path 1>/dev/null 2>/dev/null") {
diff --git a/tools/test-build b/tools/test-build
index 25981d4a6..47df0c8f0 100755
--- a/tools/test-build
+++ b/tools/test-build
@@ -18,15 +18,7 @@
#
-BEGIN {
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
@@ -42,6 +34,7 @@ $ENV{INSPIRCD_VERBOSE} = 1;
execute 'git', 'clean', '-dfx';
+my $root = dirname $RealDir;
my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
foreach my $compiler (@compilers) {
if (system "$compiler -v > /dev/null 2>&1") {
@@ -57,14 +50,14 @@ foreach my $compiler (@compilers) {
say "Attempting to build using the $compiler compiler and the $socketengine socket engine...";
my @configure_flags;
if (defined $ENV{TEST_BUILD_MODULES}) {
- execute './configure', '--enable-extras', $ENV{TEST_BUILD_MODULES};
+ execute "$root/configure", '--enable-extras', $ENV{TEST_BUILD_MODULES};
push @configure_flags, '--disable-auto-extras';
}
- if (execute './configure', '--development', '--socketengine', $socketengine, @configure_flags) {
+ if (execute "$root/configure", '--development', '--socketengine', $socketengine, @configure_flags) {
say "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
exit 1;
}
- if (execute 'make', '--jobs', get_cpu_count() + 1, 'install') {
+ if (execute 'make', '--directory', $root, '--jobs', get_cpu_count() + 1, 'install') {
say "Failed to compile using the $compiler compiler and the $socketengine socket engine!";
exit 1;
}
diff --git a/tools/testssl b/tools/testssl
index ece15984f..ea50aee4e 100755
--- a/tools/testssl
+++ b/tools/testssl
@@ -18,11 +18,7 @@
#
-BEGIN {
- require 5.10.0;
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
diff --git a/vendor/update b/vendor/update
index 20a4284bc..ca113ff29 100755
--- a/vendor/update
+++ b/vendor/update
@@ -18,15 +18,7 @@
#
-BEGIN {
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);