diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-11-11 13:49:06 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-11-11 13:49:06 +0000 |
commit | 195f44c2da47b9f0df0461b593935d89619a5a0e (patch) | |
tree | 54fda57efd461170bfb2d33977b1747e27a1b7cd | |
parent | 2db19d156087ccce3037b2bd2da1042280e17904 (diff) | |
download | drakx-backup-do-not-use-195f44c2da47b9f0df0461b593935d89619a5a0e.tar drakx-backup-do-not-use-195f44c2da47b9f0df0461b593935d89619a5a0e.tar.gz drakx-backup-do-not-use-195f44c2da47b9f0df0461b593935d89619a5a0e.tar.bz2 drakx-backup-do-not-use-195f44c2da47b9f0df0461b593935d89619a5a0e.tar.xz drakx-backup-do-not-use-195f44c2da47b9f0df0461b593935d89619a5a0e.zip |
- use "foreach" instead of "for" in list context
- use "for" instead of "foreach" when used a la C
-rw-r--r-- | perl-install/partition_table/sun.pm | 2 | ||||
-rw-r--r-- | perl-install/printer.pm | 14 | ||||
-rw-r--r-- | perl-install/printerdrake.pm | 10 | ||||
-rw-r--r-- | perl-install/resize_fat/fat.pm | 2 | ||||
-rw-r--r-- | perl-install/security/msec.pm | 4 |
5 files changed, 16 insertions, 16 deletions
diff --git a/perl-install/partition_table/sun.pm b/perl-install/partition_table/sun.pm index 6944130dc..2302b905b 100644 --- a/perl-install/partition_table/sun.pm +++ b/perl-install/partition_table/sun.pm @@ -92,7 +92,7 @@ sub read($$) { my @pt; my @infos_up = unpack $format1 x $nb_primary, $info{infos}; my @partitions_up = unpack $format2 x $nb_primary, $info{partitions}; - for (0..$nb_primary-1) { + foreach (0..$nb_primary-1) { my $h = { type => $infos_up[2 * $_], flag => $infos_up[1 + 2 * $_], start_cylinder => $partitions_up[2 * $_], size => $partitions_up[1 + 2 * $_] }; $h->{start} = $sector + $h->{start_cylinder} * $hd->cylinder_size(); diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 273a38e9f..2e426107c 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -91,7 +91,7 @@ sub spooler { sub printer_type($) { my ($printer) = @_; - for ($printer->{SPOOLER}) { + foreach ($printer->{SPOOLER}) { /cups/ && return @printer_type_inv{qw(LOCAL), qw(LPD SOCKET SMB), $::expert ? qw(URI) : ()}; @@ -710,7 +710,7 @@ sub read_configured_queues($) { $printer->{SPOOLER} ||= get_default_spooler(); if (!$printer->{SPOOLER}) { #- Find the first spooler where there are queues - for my $spooler (qw(cups pdq lprng lpd)) { + foreach my $spooler (qw(cups pdq lprng lpd)) { #- Is the spooler's daemon running? my $service = $spooler; if ($service eq "lprng") { @@ -795,7 +795,7 @@ sub read_configured_queues($) { # Fill in "options" field if (my $args = $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{args}) { my @options; - for my $arg (@{$args}) { + foreach my $arg (@{$args}) { push(@options, "-o"); my $optstr = $arg->{name} . "=" . $arg->{default}; push(@options, $optstr); @@ -914,7 +914,7 @@ sub read_printer_db(;$) { # Make one database entry per driver with the entry name # manufacturer|model|driver if ($::expert) { - for my $driver (@{$entry->{drivers}}) { + foreach my $driver (@{$entry->{drivers}}) { my $driverstr; if ($driver eq "Postscript") { $driverstr = "PostScript"; @@ -1588,7 +1588,7 @@ sub restart_queue($) { my $queue = $printer->{QUEUE}; # Restart the daemon(s) - for ($printer->{SPOOLER}) { + foreach ($printer->{SPOOLER}) { /cups/ && do { #- restart cups. restart_service("cups"); @@ -2750,7 +2750,7 @@ sub findsofficeconfigfile { "/usr/local/lib/*/share/xp3/Xpdefaults", "/usr/local/*/share/xp3/Xpdefaults", "/opt/*/share/xp3/Xpdefaults"); - for my $configfilename (@configfilenames) { + foreach my $configfilename (@configfilenames) { local *F; if (open F, "ls -r $prefix$configfilename 2> /dev/null |") { my $filename = <F>; @@ -2776,7 +2776,7 @@ sub findopenofficeconfigfile { "/usr/local/lib/*/share/psprint/psprint.conf", "/usr/local/*/share/psprint/psprint.conf", "/opt/*/share/psprint/psprint.conf"); - for my $configfilename (@configfilenames) { + foreach my $configfilename (@configfilenames) { local *F; if (open F, "ls -r $prefix$configfilename 2> /dev/null |") { my $filename = <F>; diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 86afe9e24..96ee46806 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -141,7 +141,7 @@ sub setup_printer_connection { my ($printer, $in, $upNetwork) = @_; # Choose the appropriate connection config dialog my $done = 1; - for ($printer->{TYPE}) { + foreach ($printer->{TYPE}) { /LOCAL/ and setup_local_autoscan ($printer, $in, $upNetwork) and last; /LPD/ and setup_lpd ($printer, $in, $upNetwork) and last; @@ -1601,7 +1601,7 @@ sub get_db_entry { $printer->{DBENTRY} = ""; my $make = uc($printer->{configured}{$queue}{queuedata}{make}); my $model = $printer->{configured}{$queue}{queuedata}{model}; - for my $key (keys %printer::thedb) { + foreach my $key (keys %printer::thedb) { if ((($::expert) && ($key =~ /^$make\|$model\|.*\(recommended\)$/)) || ((!$::expert) && ($key =~ /^$make\|$model$/))) { $printer->{DBENTRY} = $key; @@ -1613,7 +1613,7 @@ sub get_db_entry { $model =~ s/PS//; $model =~ s/PostScript//; $model =~ s/Series//; - for my $key (keys %printer::thedb) { + foreach my $key (keys %printer::thedb) { if ((($::expert) && ($key =~ /^$make\|$model\|.*\(recommended\)$/)) || ((!$::expert) && ($key =~ /^$make\|$model$/))) { $printer->{DBENTRY} = $key; @@ -1989,7 +1989,7 @@ sub setup_options { # enumerated option push(@choicelists, []); push(@shortchoicelists, []); - for my $choice (@{$printer->{ARGS}[$i]{vals}}) { + foreach my $choice (@{$printer->{ARGS}[$i]{vals}}) { push(@{$choicelists[$i]}, $choice->{comment}); push(@{$shortchoicelists[$i]}, $choice->{value}); if ($choice->{value} eq $optshortdefault) { @@ -3490,7 +3490,7 @@ What do you want to modify on this printer?", #- Which printer type did we have before (check beginning of #- URI) if ($printer->{configured}{$queue}) { - for my $type (qw(file lpd socket smb ncp postpipe)) { + foreach my $type (qw(file lpd socket smb ncp postpipe)) { if ($printer->{currentqueue}{connect} =~ /^$type:/) { $printer->{TYPE} = diff --git a/perl-install/resize_fat/fat.pm b/perl-install/resize_fat/fat.pm index 27252ef2b..bb762e28e 100644 --- a/perl-install/resize_fat/fat.pm +++ b/perl-install/resize_fat/fat.pm @@ -104,7 +104,7 @@ sub endianness($$) { sub get_free($) { my ($fs) = @_; - foreach (my $i = 0; $i < $fs->{nb_clusters}; $i++) { + for (my $i = 0; $i < $fs->{nb_clusters}; $i++) { my $cluster = ($i + $fs->{last_free_cluster} - 2) % $fs->{nb_clusters} + 2; is_available(&next($fs, $cluster)) and return $fs->{last_free_cluster} = $cluster; } diff --git a/perl-install/security/msec.pm b/perl-install/security/msec.pm index 76142da0d..4392b0038 100644 --- a/perl-install/security/msec.pm +++ b/perl-install/security/msec.pm @@ -80,7 +80,7 @@ sub get_default { elsif ($category eq "checks") { $default_file = "$::prefix/var/lib/msec/security.conf"; } open F, $default_file; - while(<F>) { + while (<F>) { if ($category eq 'functions') { if ($_ =~ /^$option/) { (undef, $default_value) = split(/ /, $_) } } elsif ($category eq 'checks') { @@ -102,7 +102,7 @@ sub get_value { if (-e $item_file) { open F, $item_file; - while(<F>) { + while (<F>) { if ($_ =~ /^$item/) { if ($category eq 'functions') { my $i = $_; |