summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-06 17:40:43 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-06 17:40:43 +0000
commit5a7014d19c1843b37e135e34ab3e973b706de07e (patch)
tree31d9000be3561d7614ef0c4e6de0063b4fd3cbbb
parentb8a25c88bba7e597dd0c148e15693672d2a30f85 (diff)
downloaddrakx-5a7014d19c1843b37e135e34ab3e973b706de07e.tar
drakx-5a7014d19c1843b37e135e34ab3e973b706de07e.tar.gz
drakx-5a7014d19c1843b37e135e34ab3e973b706de07e.tar.bz2
drakx-5a7014d19c1843b37e135e34ab3e973b706de07e.tar.xz
drakx-5a7014d19c1843b37e135e34ab3e973b706de07e.zip
replace "for my ..." with "foreach my ..."
-rw-r--r--perl-install/printer.pm38
-rw-r--r--perl-install/printerdrake.pm28
2 files changed, 33 insertions, 33 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 73328070a..aabfb7844 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -488,7 +488,7 @@ sub getIPsInLocalNetworks {
my @addresses;
# Now ping all broadcast addresses and additionally "nmblookup" the
# networks (to find Windows servers which do not answer to ping)
- for my $bcast (@local_bcasts) {
+ foreach my $bcast (@local_bcasts) {
local *F;
open F, ($::testing ? "" : "chroot $prefix/ ") .
"/bin/sh -c \"export LC_ALL=C; ping -w 1 -b -n $bcast | cut -f 4 -d ' ' | sed s/:// | egrep '^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+' | uniq | sort\" |"
@@ -571,7 +571,7 @@ sub whatNetPrinter {
# SMB/Windows
if ($port eq "139") {
my @shares = getSMBPrinterShares($ip);
- for my $share (@shares) {
+ foreach my $share (@shares) {
push @res, { port => "smb://$host/$share->{name}",
val => { CLASS => 'PRINTER',
MODEL => N("Unknown Model"),
@@ -635,7 +635,7 @@ sub add_spooler_to_security_level {
sub files_exist {
my @files = @_;
- for my $file (@files) {
+ foreach my $file (@files) {
return 0 if (! -f "$prefix$file"),
}
return 1;
@@ -2317,7 +2317,7 @@ sub configurestaroffice {
if (0 && ($printer->{SPOOLER} eq "cups") &&
((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) {
my @printerlist = getcupsremotequeues();
- for my $listentry (@printerlist) {
+ foreach my $listentry (@printerlist) {
next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/);
my $queue = $1;
my $server = $2;
@@ -2341,7 +2341,7 @@ sub configurestaroffice {
}
}
# Update local printer queues
- for my $queue (keys(%{$printer->{configured}})) {
+ foreach my $queue (keys(%{$printer->{configured}})) {
# Check if we have a PPD file
if (! -r "$prefix/etc/foomatic/$queue.ppd") {
if (-r "$prefix/etc/cups/ppd/$queue.ppd") {
@@ -2390,7 +2390,7 @@ sub configureopenoffice {
if (0 && ($printer->{SPOOLER} eq "cups") &&
((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) {
my @printerlist = getcupsremotequeues();
- for my $listentry (@printerlist) {
+ foreach my $listentry (@printerlist) {
next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/);
my $queue = $1;
my $server = $2;
@@ -2414,7 +2414,7 @@ sub configureopenoffice {
}
}
# Update local printer queues
- for my $queue (keys(%{$printer->{configured}})) {
+ foreach my $queue (keys(%{$printer->{configured}})) {
# Check if we have a PPD file
if (! -r "$prefix/etc/foomatic/$queue.ppd") {
if (-r "$prefix/etc/cups/ppd/$queue.ppd") {
@@ -2463,7 +2463,7 @@ sub addcupsremotetostaroffice {
if (($printer->{SPOOLER} eq "cups") &&
((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) {
my @printerlist = getcupsremotequeues();
- for my $listentry (@printerlist) {
+ foreach my $listentry (@printerlist) {
next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/);
my $q = $1;
next if $q ne $queue;
@@ -2513,7 +2513,7 @@ sub addcupsremotetoopenoffice {
if (($printer->{SPOOLER} eq "cups") &&
((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) {
my @printerlist = getcupsremotequeues();
- for my $listentry (@printerlist) {
+ foreach my $listentry (@printerlist) {
next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/);
my $q = $1;
next if $q ne $queue;
@@ -2593,7 +2593,7 @@ sub removelocalprintersfromstaroffice {
# Load Star Office printer config file
my $configfilecontent = readsofficeconfigfile($configfilename);
# Remove the printer entries
- for my $queue (keys(%{$printer->{configured}})) {
+ foreach my $queue (keys(%{$printer->{configured}})) {
$configfilecontent =
removestarofficeprinterentry($printer, $queue, $configprefix,
$configfilecontent);
@@ -2612,7 +2612,7 @@ sub removelocalprintersfromopenoffice {
# Load OpenOffice.org printer config file
my $configfilecontent = readsofficeconfigfile($configfilename);
# Remove the printer entries
- for my $queue (keys(%{$printer->{configured}})) {
+ foreach my $queue (keys(%{$printer->{configured}})) {
$configfilecontent =
removeopenofficeprinterentry($printer, $queue, $configprefix,
$configfilecontent);
@@ -2957,11 +2957,11 @@ sub configuregimp {
my @configfilenames = findgimpconfigfiles();
return 1 if $#configfilenames < 0;
# There is no system-wide config file, treat every user's config file
- for my $configfilename (@configfilenames) {
+ foreach my $configfilename (@configfilenames) {
# Load GIMP's printer config file
my $configfilecontent = readgimpconfigfile($configfilename);
# Update local printer queues
- for my $queue (keys(%{$printer->{configured}})) {
+ foreach my $queue (keys(%{$printer->{configured}})) {
# Check if we have a PPD file
if (! -r "$prefix/etc/foomatic/$queue.ppd") {
if (-r "$prefix/etc/cups/ppd/$queue.ppd") {
@@ -3021,7 +3021,7 @@ sub addcupsremotetogimp {
my $ppdfile = "";
if (($printer->{SPOOLER} eq "cups") &&
((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) {
- for my $listentry (@printerlist) {
+ foreach my $listentry (@printerlist) {
next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/);
my $q = $1;
next if $q ne $queue;
@@ -3053,7 +3053,7 @@ sub addcupsremotetogimp {
return 1;
}
# There is no system-wide config file, treat every user's config file
- for my $configfilename (@configfilenames) {
+ foreach my $configfilename (@configfilenames) {
# Load GIMP's printer config file
my $configfilecontent = readgimpconfigfile($configfilename);
# Add the printer entry
@@ -3078,7 +3078,7 @@ sub removeprinterfromgimp {
my @configfilenames = findgimpconfigfiles();
return 1 if $#configfilenames < 0;
# There is no system-wide config file, treat every user's config file
- for my $configfilename (@configfilenames) {
+ foreach my $configfilename (@configfilenames) {
# Load GIMP's printer config file
my $configfilecontent = readgimpconfigfile($configfilename);
# Remove the printer entry
@@ -3096,11 +3096,11 @@ sub removelocalprintersfromgimp {
my @configfilenames = findgimpconfigfiles();
return 1 if $#configfilenames < 0;
# There is no system-wide config file, treat every user's config file
- for my $configfilename (@configfilenames) {
+ foreach my $configfilename (@configfilenames) {
# Load GIMP's printer config file
my $configfilecontent = readgimpconfigfile($configfilename);
# Remove the printer entries
- for my $queue (keys(%{$printer->{configured}})) {
+ foreach my $queue (keys(%{$printer->{configured}})) {
$configfilecontent =
removegimpprinter($queue, $configfilecontent);
}
@@ -3186,7 +3186,7 @@ sub findgimpconfigfiles {
if (/^([^:]+):[^:]*:([^:]+):([^:]+):[^:]*:([^:]+):[^:]*$/) {
my ($username, $uid, $gid, $homedir) = ($1, $2, $3, $4);
if ((($uid == 0) || ($uid >= 500)) && ($username ne "nobody")) {
- for my $file (@configfilenames) {
+ foreach my $file (@configfilenames) {
my $dir = "$homedir/$file";
$dir =~ s:/[^/]*$::;
next if (-f $dir) && (! -d $dir);
diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm
index bdfa1315f..992b61a59 100644
--- a/perl-install/printerdrake.pm
+++ b/perl-install/printerdrake.pm
@@ -192,7 +192,7 @@ sub first_time_dialog {
push (@printerlist, N("There are no printers found which are directly connected to your machine"));
} else {
$localprinterspresent = 1;
- for my $printer (@autodetected) {
+ foreach my $printer (@autodetected) {
my $entry = $printer->{val}{DESCRIPTION};
if ($entry) { push (@printerlist, " - $entry\n") }
}
@@ -413,7 +413,7 @@ sub setup_local_autoscan {
# We have more than one printer, so we must ask the user for a queue
# name in the fully automatic printer configuration.
$printer->{MORETHANONE} = ($#autodetected > 0);
- for my $p (@autodetected) {
+ foreach my $p (@autodetected) {
if ($p->{val}{DESCRIPTION}) {
my $menustr = $p->{val}{DESCRIPTION};
if ($p->{port} =~ m!^/dev/lp(\d+)$!) {
@@ -449,10 +449,10 @@ sub setup_local_autoscan {
}
if ($::expert) {
@port = detect_devices::whatPrinterPort();
- for my $q (@port) {
+ foreach my $q (@port) {
if (@str) {
my $alreadyfound = 0;
- for my $p (@autodetected) {
+ foreach my $p (@autodetected) {
if ($p->{port} eq $q) {
$alreadyfound = 1;
last;
@@ -514,7 +514,7 @@ sub setup_local_autoscan {
# Non-HP or HP print-only device (HPOJ not used)
$device = $printer->{currentqueue}{connect};
$device =~ s/^file://;
- for my $p (keys %{$menuentries}) {
+ foreach my $p (keys %{$menuentries}) {
if ($device eq $menuentries->{$p}) {
$menuchoice = $p;
last;
@@ -527,7 +527,7 @@ sub setup_local_autoscan {
$ptaldevice =~ s!^ptal:/mlc:!!;
if ($ptaldevice =~ /^par:(\d+)$/) {
$device = "/dev/lp$1";
- for my $p (keys %{$menuentries}) {
+ foreach my $p (keys %{$menuentries}) {
if ($device eq $menuentries->{$p}) {
$menuchoice = $p;
last;
@@ -537,7 +537,7 @@ sub setup_local_autoscan {
my $make = lc($printer->{currentqueue}{make});
my $model = lc($printer->{currentqueue}{model});
$device = "";
- for my $p (keys %{$menuentries}) {
+ foreach my $p (keys %{$menuentries}) {
my $menumakemodel = lc($p);
if (($menumakemodel =~ /$make/) &&
($menumakemodel =~ /$model/)) {
@@ -551,7 +551,7 @@ sub setup_local_autoscan {
($printer->{currentqueue}{connect} =~ m!^(socket|smb):/!)) {
# Ethernet-(TCP/Socket)-connected printer or printer on Windows server
$device = $printer->{currentqueue}{connect};
- for my $p (keys %{$menuentries}) {
+ foreach my $p (keys %{$menuentries}) {
if ($device eq $menuentries->{$p}) {
$menuchoice = $p;
last;
@@ -807,7 +807,7 @@ sub setup_smb {
}
my $w = $in->wait_message(N("Printer auto-detection"), N("Scanning network..."));
@autodetected = net_smb_detect();
- for my $p (@autodetected) {
+ foreach my $p (@autodetected) {
my $menustr;
$p->{port} =~ m!^smb://([^/:]+)/([^/:]+)$!;
my $server = $1;
@@ -1047,7 +1047,7 @@ sub setup_socket {
$autodetect = 1;
my $w = $in->wait_message(N("Printer auto-detection"), N("Scanning network..."));
@autodetected = net_detect();
- for my $p (@autodetected) {
+ foreach my $p (@autodetected) {
my $menustr;
$p->{port} =~ m!^socket://([^:]+):(\d+)$!;
my $host = $1;
@@ -1467,7 +1467,7 @@ sub setup_common {
# If there is more than one matching database entry, the longest match
# counts.
my $matchlength = 0;
- for my $entry (keys %printer::thedb) {
+ foreach my $entry (keys %printer::thedb) {
my $dbmakemodel;
if ($::expert) {
$entry =~ m/^(.*)\|[^\|]*$/;
@@ -1640,7 +1640,7 @@ sub get_db_entry {
} else {
if (($::expert) && ($printer->{DBENTRY} !~ /(recommended)/)) {
my ($make, $model) = $printer->{DBENTRY} =~ /^([^\|]+)\|([^\|]+)\|/;
- for my $key (keys %printer::thedb) {
+ foreach my $key (keys %printer::thedb) {
if ($key =~ /^$make\|$model\|.*\(recommended\)$/) {
$printer->{DBENTRY} = $key;
}
@@ -3635,8 +3635,8 @@ What do you want to modify on this printer?",
$printer->{complete} = 0;
}
# Clean up the $printer data structure for auto-install log
- for my $queue (keys %{$printer->{configured}}) {
- for my $item (keys %{$printer->{configured}{$queue}}) {
+ foreach my $queue (keys %{$printer->{configured}}) {
+ foreach my $item (keys %{$printer->{configured}{$queue}}) {
if ($item ne "queuedata") {
delete($printer->{configured}{$queue}{$item});
}