]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Always use for in Perl modules.
authorSadie Powell <sadie@witchery.services>
Fri, 29 Jan 2021 13:46:37 +0000 (13:46 +0000)
committerSadie Powell <sadie@witchery.services>
Fri, 29 Jan 2021 13:46:37 +0000 (13:46 +0000)
configure
make/calcdep.pl
make/configure.pm
make/template/inspircd
tools/test-build

index 5d4520f31066e85ab9bedf009b3ef1ab589a6b71..2e19228ba13ab216c8dd58c6d60890777f406b24 100755 (executable)
--- a/configure
+++ b/configure
@@ -336,7 +336,7 @@ EOQ
 if (prompt_bool $interactive, $question, 0) {
        my $original_base_dir = $config{BASE_DIR};
        $config{BASE_DIR} = prompt_dir $interactive, 'In what directory do you wish to install the InspIRCd base?', $config{BASE_DIR};
-       foreach my $key (qw(BINARY_DIR CONFIG_DIR DATA_DIR LOG_DIR MANUAL_DIR MODULE_DIR SCRIPT_DIR)) {
+       for my $key (qw(BINARY_DIR CONFIG_DIR DATA_DIR LOG_DIR MANUAL_DIR MODULE_DIR SCRIPT_DIR)) {
                $config{$key} =~ s/^\Q$original_base_dir\E/$config{BASE_DIR}/;
        }
        $config{BINARY_DIR} = prompt_dir $interactive, 'In what directory should the InspIRCd binary be placed?', $config{BINARY_DIR};
@@ -357,7 +357,7 @@ Currently, InspIRCd is configured to automatically enable all available extra mo
 Would you like to enable extra modules manually?
 EOQ
 if (prompt_bool $interactive, $question, 0) {
-       foreach my $extra (<$RealDir/src/modules/extra/m_*.cpp>) {
+       for my $extra (<$RealDir/src/modules/extra/m_*.cpp>) {
                my $module_name = module_shrink $extra;
                if (prompt_bool $interactive, "Would you like to enable the <|BOLD $module_name|> module?", 0) {
                        enable_extras $module_name;
index 3c02024fa3ce65cfd6102a776ccab840288da4ff..ca6b2628c2557c344d2b2916ae0624f70cd125da 100755 (executable)
@@ -90,7 +90,7 @@ END
                push @core_deps, $out;
        }
 
-       foreach my $directory (qw(coremods modules)) {
+       for my $directory (qw(coremods modules)) {
                opendir(my $moddir, $directory);
                for my $file (sort readdir $moddir) {
                        next if $file =~ /^\./;
index 86ce8d0a17d4439b126fe9674c2066b0ba69ba75..c044fd1046e955bc095c9a94623b37ef15773fad 100644 (file)
@@ -58,7 +58,7 @@ our @EXPORT = qw(CONFIGURE_CACHE_FILE
 
 sub __get_socketengines {
        my @socketengines;
-       foreach (<${\CONFIGURE_ROOT}/src/socketengines/socketengine_*.cpp>) {
+       for (<${\CONFIGURE_ROOT}/src/socketengines/socketengine_*.cpp>) {
                s/src\/socketengines\/socketengine_(\w+)\.cpp/$1/;
                push @socketengines, $1;
        }
@@ -261,7 +261,7 @@ sub get_compiler_info($) {
 
 sub find_compiler {
        my @compilers = qw(c++ g++ clang++ icpc);
-       foreach my $compiler (shift // @compilers) {
+       for my $compiler (shift // @compilers) {
                return $compiler if __test_compiler $compiler;
                return "xcrun $compiler" if $^O eq 'darwin' && __test_compiler "xcrun $compiler";
        }
@@ -276,7 +276,7 @@ sub parse_templates($$$) {
        my %settings = __get_template_settings($config, $compiler, $version);
 
        # Iterate through files in make/template.
-       foreach my $template (<${\CONFIGURE_ROOT}/make/template/*>) {
+       for my $template (<${\CONFIGURE_ROOT}/make/template/*>) {
                say console_format "Parsing <|GREEN ${\abs2rel $template, CONFIGURE_ROOT}|> ...";
                open(my $fh, $template) or print_error "unable to read $template: $!";
                my (@lines, $mode, @platforms, @targets);
@@ -343,7 +343,7 @@ sub parse_templates($$$) {
                                # Write the template file.
                                say console_format "Writing <|GREEN ${\abs2rel $target, CONFIGURE_ROOT}|> ...";
                                open(my $fh, '>', $target) or print_error "unable to write $target: $!";
-                               foreach (@lines) {
+                               for (@lines) {
                                        say $fh $_;
                                }
                                close $fh;
index 4b316e0e017c47fb4010b8806a8a7f8de64c3a46..70072df601462645bebc9009364fff00ac8a8692 100644 (file)
@@ -149,8 +149,8 @@ sub cmd_help()
        my @cmds = grep /^cmd_/, @subs;
        my @devs = grep /^dev_/, @subs;
        local $_;
-       $_ =~ s/^(cmd|dev)_// foreach (@cmds, @devs);
-       $_ =~ s/_/-/g foreach (@cmds, @devs);
+       $_ =~ s/^(cmd|dev)_// for (@cmds, @devs);
+       $_ =~ s/_/-/g for (@cmds, @devs);
        print STDERR "Usage: ./inspircd (" . join("|", @cmds) . ")\n";
        print STDERR "Developer arguments: (" . join("|", @devs) . ")\n";
        exit GENERIC_EXIT_SUCCESS;
index 47df0c8f0aa83355b2b6d94141f6d29b27b1e443..9312940b615198810d0197f0b9abf3e2f9f827c0 100755 (executable)
@@ -36,7 +36,7 @@ execute 'git', 'clean', '-dfx';
 
 my $root = dirname $RealDir;
 my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
-foreach my $compiler (@compilers) {
+for my $compiler (@compilers) {
        if (system "$compiler -v > /dev/null 2>&1") {
                say "Skipping $compiler as it is not installed on this system!";
                next;
@@ -46,7 +46,7 @@ foreach my $compiler (@compilers) {
        push @socketengines, 'epoll' if test_header $compiler, 'sys/epoll.h';
        push @socketengines, 'kqueue' if test_file $compiler, 'kqueue.cpp';
        push @socketengines, 'poll' if test_header $compiler, 'poll.h';
-       foreach my $socketengine (@socketengines) {
+       for my $socketengine (@socketengines) {
                say "Attempting to build using the $compiler compiler and the $socketengine socket engine...";
                my @configure_flags;
                if (defined $ENV{TEST_BUILD_MODULES}) {