diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-01-07 13:22:28 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-01-07 13:22:28 +0000 |
commit | c2f200920f04dba0874c054038770a91a71fbba5 (patch) | |
tree | 7448485cea94afcd511535b592b1f061c543f3b9 /perl-install/network | |
parent | 0a813b0ea3c7c30ca81e79b6303f5141e95fee4b (diff) | |
download | drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar.gz drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar.bz2 drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar.xz drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.zip |
use "if any" instead of "if grep", and various other occurences of "any", "every", "partition"
Diffstat (limited to 'perl-install/network')
-rw-r--r-- | perl-install/network/drakfirewall.pm | 9 | ||||
-rw-r--r-- | perl-install/network/ethernet.pm | 2 | ||||
-rw-r--r-- | perl-install/network/network.pm | 6 | ||||
-rw-r--r-- | perl-install/network/smb.pm | 2 |
4 files changed, 9 insertions, 10 deletions
diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm index 8951ecd44..084a656fd 100644 --- a/perl-install/network/drakfirewall.pm +++ b/perl-install/network/drakfirewall.pm @@ -54,10 +54,9 @@ my @all_servers = sub port2server { my ($port) = @_; - foreach (@all_servers) { - return $_ if grep { $port eq $_ } split ' ', $_->{ports}; - } - undef; + find { + any { $port eq $_ } split(' ', $_->{ports}); + } @all_servers; } sub check_ports_syntax { @@ -95,7 +94,7 @@ sub default_from_pkgs { my @pkgs = $in->do_pkgs->are_installed(map { split ' ', $_->{pkg} } @all_servers); [ grep { my $s = $_; - grep { member($_, @pkgs) } split ' ', $s->{pkg}; + any { member($_, @pkgs) } (split ' ', $s->{pkg}); } @all_servers ]; } diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 69135e363..91eac7d69 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -62,7 +62,7 @@ sub configure_lan { configureNetwork($netc, $intf, $first_time) or return; configureNetwork2($in, $prefix, $netc, $intf); $netc->{NETWORKING} = "yes"; - if ($netc->{GATEWAY} || grep { $_->{BOOTPROTO} eq 'dhcp' } values %$intf) { + if ($netc->{GATEWAY} || any { $_->{BOOTPROTO} eq 'dhcp' } values %$intf) { $netcnx->{type} = 'lan'; $netcnx->{NET_DEVICE} = $netc->{NET_DEVICE} = ''; $netcnx->{NET_INTERFACE} = 'lan'; #$netc->{NET_INTERFACE}; diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 888630b3d..bce84c86f 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -203,7 +203,7 @@ my $ip_regexp = qr/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; sub is_ip { my ($ip) = @_; my @fields = $ip =~ $ip_regexp or return; - return if grep { $_ < 0 || $_ > 255 } @fields; + every { 0 <= $_ && $_ <= 255 } @fields or return; @fields; } sub is_domain_name { @@ -449,10 +449,10 @@ sub configureNetwork2 { write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_, $prefix) foreach grep { $_->{DEVICE} } values %$intf; add2hosts("$etc/hosts", $netc->{HOSTNAME}, map { $_->{IPADDR} } values %$intf); - if (grep { $_->{BOOTPROTO} =~ /^(dhcp)$/ } values %$intf) { + if (any { $_->{BOOTPROTO} =~ /^(dhcp)$/ } values %$intf) { $in->do_pkgs->install($netc->{dhcp_client} ? $netc->{dhcp_client} : 'dhcpcd'); } - if (grep { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } values %$intf) { + if (any { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } values %$intf) { $in->do_pkgs->install('pump'); } #-res_init(); #- reinit the resolver so DNS changes take affect diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm index 7adf01a3a..6215e3150 100644 --- a/perl-install/network/smb.pm +++ b/perl-install/network/smb.pm @@ -70,7 +70,7 @@ sub find_servers { my ($group, $name) = split(' ', lc($_)); # already done - next if grep { $group eq $_->{group} } values %servers; + next if any { $group eq $_->{group} } values %servers; $l{$name} = $group; } |