Fix unnecessary begin blocks in Perl source files.

This commit is contained in:
Sadie Powell 2021-01-25 12:13:54 +00:00
parent cc28ba0f21
commit f6b861f12d
15 changed files with 35 additions and 109 deletions

6
configure vendored
View File

@ -30,11 +30,7 @@
# #
BEGIN { use v5.10.0;
require 5.10.0;
}
use feature ':5.10';
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

View File

@ -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 strict;
use warnings FATAL => qw(all); 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 make::common;
use constant { use constant {

View File

@ -17,13 +17,9 @@
# #
BEGIN {
require 5.10.0;
}
package make::common; package make::common;
use feature ':5.10'; use v5.10.0;
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

View File

@ -21,13 +21,9 @@
# #
BEGIN {
require 5.10.0;
}
package make::configure; package make::configure;
use feature ':5.10'; use v5.10.0;
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

View File

@ -19,11 +19,7 @@
package make::console; package make::console;
BEGIN { use v5.10.0;
require 5.10.0;
}
use feature ':5.10';
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

View File

@ -19,11 +19,7 @@
package make::directive; package make::directive;
BEGIN { use v5.10.0;
require 5.10.0;
}
use feature ':5.10';
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

View File

@ -22,16 +22,15 @@
# #
BEGIN { use v5.10.0;
push @INC, $ENV{SOURCEPATH};
require 5.10.0;
}
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);
use File::Basename qw(dirname);
use File::Spec::Functions qw(abs2rel); use File::Spec::Functions qw(abs2rel);
use FindBin qw($RealDir);
use lib dirname $RealDir;
use make::console; use make::console;
use make::directive; use make::directive;

View File

@ -22,7 +22,6 @@
BEGIN { BEGIN {
require 5.10.0;
unless (eval "use LWP::Simple; 1") { unless (eval "use LWP::Simple; 1") {
die "Your system is missing the LWP::Simple Perl module!"; 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 strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);
@ -65,7 +64,7 @@ sub parse_url {
return if $url_seen{$src}; return if $url_seen{$src};
$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); my $response = $ua->get($src);
unless ($response->is_success) { 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..). # 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 # useless helper stub
sub getmodversion { sub getmodversion {
@ -116,7 +115,7 @@ sub getmodversion {
} }
# read in external URL sources # 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>) { while (<SRC>) {
next if /^\s*#/; next if /^\s*#/;
parse_url($_); parse_url($_);
@ -310,7 +309,7 @@ print "Processing changes...\n";
for my $mod (keys %installed) { for my $mod (keys %installed) {
next if $todo{$mod}; next if $todo{$mod};
print "Uninstalling $mod $installed{$mod}\n"; print "Uninstalling $mod $installed{$mod}\n";
unlink "src/modules/$mod.cpp"; unlink "$RealDir/src/modules/$mod.cpp";
} }
my $count = scalar keys %todo; my $count = scalar keys %todo;
@ -334,7 +333,7 @@ for my $mod (sort keys %todo) {
my $response = $ua->get($url); my $response = $ua->get($url);
if ($response->is_success) { 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; print MF $response->content;
close(MF); close(MF);
print " - done\n"; print " - done\n";
@ -344,6 +343,6 @@ for my $mod (sort keys %todo) {
} }
# write database of installed versions # write database of installed versions
write_config_file '.modulemanager', %mod_versions; write_config_file "$RealDir/.modulemanager", %mod_versions;
print "Finished!\n"; print "Finished!\n";

View File

@ -18,15 +18,7 @@
# #
BEGIN { use v5.10.0;
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 strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

View File

@ -19,11 +19,7 @@
# #
BEGIN { use v5.10.0;
require 5.10.0;
}
use feature ':5.10';
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

View File

@ -18,15 +18,7 @@
# #
BEGIN { use v5.10.0;
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 strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);
@ -42,7 +34,7 @@ use lib dirname $RealDir;
use make::common; use make::common;
use make::console; use make::console;
if (scalar @ARGV < 1) { unless (scalar @ARGV) {
print_format "<|GREEN Usage:|> $0 <<|UNDERLINE DOCS-SITE|>>\n", *STDERR; print_format "<|GREEN Usage:|> $0 <<|UNDERLINE DOCS-SITE|>>\n", *STDERR;
exit 1; exit 1;
} }
@ -51,7 +43,8 @@ my %version = get_version();
my $docdir = rel2abs catdir $ARGV[0], 'docs', $version{MAJOR}, 'modules'; my $docdir = rel2abs catdir $ARGV[0], 'docs', $version{MAJOR}, 'modules';
print_error "unable to find the module directory at $docdir!" unless -d $docdir; 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+)[.\/]/; print_error "unable to extract module name from $module!" unless $module =~ /m_(\w+)[.\/]/;
my $docfile = catfile $docdir, "$1.md"; my $docfile = catfile $docdir, "$1.md";
print_error "unable to find the module documentation at $docfile!" unless -f $docfile; print_error "unable to find the module documentation at $docfile!" unless -f $docfile;

View File

@ -18,15 +18,7 @@
# #
BEGIN { use v5.10.0;
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 strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);
@ -49,11 +41,12 @@ my @ignored_revisions = (
'f2acdbc3820f0f4f5ef76a0a64e73d2a320df91f', # peavey fixing line endings '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; my @updated;
for my $path (@paths) { for my $path (@paths) {
next unless -f $path; next unless -f $path;
next if $path =~ /\/\./; next if $path =~ /\/\./;
next if $path =~ /\/build\//;
next if $path =~ /\/vendor\//; next if $path =~ /\/vendor\//;
if (system "git ls-files --error-unmatch -- $path 1>/dev/null 2>/dev/null") { if (system "git ls-files --error-unmatch -- $path 1>/dev/null 2>/dev/null") {

View File

@ -18,15 +18,7 @@
# #
BEGIN { use v5.10.0;
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 strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);
@ -42,6 +34,7 @@ $ENV{INSPIRCD_VERBOSE} = 1;
execute 'git', 'clean', '-dfx'; execute 'git', 'clean', '-dfx';
my $root = dirname $RealDir;
my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc); my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
foreach my $compiler (@compilers) { foreach my $compiler (@compilers) {
if (system "$compiler -v > /dev/null 2>&1") { 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..."; say "Attempting to build using the $compiler compiler and the $socketengine socket engine...";
my @configure_flags; my @configure_flags;
if (defined $ENV{TEST_BUILD_MODULES}) { 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'; 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!"; say "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
exit 1; 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!"; say "Failed to compile using the $compiler compiler and the $socketengine socket engine!";
exit 1; exit 1;
} }

View File

@ -18,11 +18,7 @@
# #
BEGIN { use v5.10.0;
require 5.10.0;
}
use feature ':5.10';
use strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);

10
vendor/update vendored
View File

@ -18,15 +18,7 @@
# #
BEGIN { use v5.10.0;
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 strict; use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);