diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/commands.pm | 24 | ||||
-rw-r--r-- | perl-install/detect_devices.pm | 3 | ||||
-rw-r--r-- | perl-install/partition_table/mac.pm | 8 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 2 | ||||
-rw-r--r-- | perl-install/printer.pm | 23 | ||||
-rw-r--r-- | perl-install/printerdrake.pm | 13 | ||||
-rwxr-xr-x | perl-install/scanner.pm | 2 |
7 files changed, 33 insertions, 42 deletions
diff --git a/perl-install/commands.pm b/perl-install/commands.pm index be82a2020..e05c0c2db 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -244,13 +244,14 @@ sub ps { @>>>> @>>>> @>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $pid, $rss, $cpu, $cmd . - foreach $pid (sort { $a <=> $b } grep { /\d+/ } all('/proc')) { - my @l = split(' ', cat_("/proc/$pid/stat")); - $cpu = sprintf "%2.1f", max(0, min(99, ($l[13] + $l[14]) * 100 / $hertz / ($uptime - $l[21] / $hertz))); - $rss = (split ' ', cat_("/proc/$pid/stat"))[23] * $page; - (($cmd) = cat_("/proc/$pid/cmdline")) =~ s/\0/ /g; - $cmd ||= (split ' ', (cat_("/proc/$pid/stat"))[0])[1]; - write PS; + foreach (sort { $a <=> $b } grep { /\d+/ } all('/proc')) { + $pid = $_; + my @l = split(' ', cat_("/proc/$pid/stat")); + $cpu = sprintf "%2.1f", max(0, min(99, ($l[13] + $l[14]) * 100 / $hertz / ($uptime - $l[21] / $hertz))); + $rss = (split ' ', cat_("/proc/$pid/stat"))[23] * $page; + (($cmd) = cat_("/proc/$pid/cmdline")) =~ s/\0/ /g; + $cmd ||= (split ' ', (cat_("/proc/$pid/stat"))[0])[1]; + write PS; } } @@ -391,7 +392,7 @@ sub insmod { #- try to install the module if it exist else extract it from archive. #- needed for cardmgr. unless (-r $f) { - $_ = $1 if m@.*/([^/]*)\.o@; + $_ = $1 if m!.*/([^/]*)\.o!; unless (-r ($f = "/lib/modules/$_.o")) { $f = "/tmp/$_.o"; my $cz = "/lib/modules" . (arch() eq 'sparc64' && "64") . ".cz"; -e $cz or $cz .= "2"; @@ -462,7 +463,8 @@ $dev, $size, $used, $free, $use, $mntpoint ($dev, $mntpoint) = split; $h{$dev} = $mntpoint; } - foreach $dev (sort keys %h) { + foreach (sort keys %h) { + $dev = $_; ($size, $free) = MDK::Common::System::df($mntpoint = $h{$dev}); $size or next; @@ -497,9 +499,9 @@ sub sort { $h and die "usage: sort [-n] [<file>]\n"; local *F; @_ ? open(F, $_[0]) || die "error: can't open file $_[0]\n" : (*F = *STDIN); if ($n) { - print sort { $a <=> $b } <F>; + print(sort { $a <=> $b } <F>); } else { - print sort <F>; + print(sort <F>); } } diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index ce7ceab7e..ca4bc3240 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -609,9 +609,8 @@ sub whatUsbport() { # This routine based on an ioctl request gives very clean and correct # manufacturer and model names, so that they are easily matched to the # printer entries in the Foomatic database - my $i; my @res; - foreach $i (0..15) { + foreach my $i (0..15) { my $port = "/dev/usb/lp$i"; my $realport = devices::make($port); next if !$realport; diff --git a/perl-install/partition_table/mac.pm b/perl-install/partition_table/mac.pm index 45c614139..33b63aa99 100644 --- a/perl-install/partition_table/mac.pm +++ b/perl-install/partition_table/mac.pm @@ -105,9 +105,8 @@ sub read($$) { sysread F, $tmp, psizeof($bz_format) or die "error while reading bz \(Block Zero\) in sector $sector"; my %info; @info{@$bz_fields} = unpack $bz_format, $tmp; - my $i; - foreach $i (0 .. $info{bzDrvrCnt}-1) { + foreach my $i (0 .. $info{bzDrvrCnt}-1) { sysread F, $tmp, psizeof($dd_format) or die "error while reading driver data in sector $sector"; my %dd; @dd{@$dd_fields} = unpack $dd_format, $tmp; push @{$info{ddMap}}, \%dd; @@ -129,7 +128,7 @@ sub read($$) { c::lseek_sector(fileno(F), $sector, 512) or die "reading of partition in sector $sector failed"; my @pt; - for ($i=0;$i<$partmapsize;$i++) { + for (my $i=0;$i<$partmapsize;$i++) { my $part; sysread F, $part, psizeof($p_format) or die "error while reading partition info in sector $sector"; @@ -240,8 +239,7 @@ sub write($$$;$) { # Since we didn't create any new drivers, let's try and match up our driver records with out partitons and see if any are missing. $info->{bzDrvrCnt} = 0; my @ddstowrite; - my $dd; - foreach $dd (@{$info->{ddMap}}) { + foreach my $dd (@{$info->{ddMap}}) { foreach (@partstowrite) { if ($dd->{ddBlock} == $_->{pPBlockStart}) { push @ddstowrite, $dd; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 816858360..1f55bed41 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -843,7 +843,7 @@ sub installTransactionClosure { $l[0] >= $_->{start} and $medium = $_, last; #- ... but it could be necessary to find the first #- medium containing package of @l. - foreach $id (@l) { + foreach my $id (@l) { $id >= $_->{start} && $id <= $_->{end} and $medium = $_, last; } $medium and last; diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 5e5559ebe..273a38e9f 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -710,8 +710,7 @@ sub read_configured_queues($) { $printer->{SPOOLER} ||= get_default_spooler(); if (!$printer->{SPOOLER}) { #- Find the first spooler where there are queues - my $spooler; - for $spooler (qw(cups pdq lprng lpd)) { + for my $spooler (qw(cups pdq lprng lpd)) { #- Is the spooler's daemon running? my $service = $spooler; if ($service eq "lprng") { @@ -795,9 +794,8 @@ sub read_configured_queues($) { } # Fill in "options" field if (my $args = $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{args}) { - my $arg; my @options; - for $arg (@{$args}) { + for my $arg (@{$args}) { push(@options, "-o"); my $optstr = $arg->{name} . "=" . $arg->{default}; push(@options, $optstr); @@ -916,8 +914,7 @@ sub read_printer_db(;$) { # Make one database entry per driver with the entry name # manufacturer|model|driver if ($::expert) { - my $driver; - for $driver (@{$entry->{drivers}}) { + for my $driver (@{$entry->{drivers}}) { my $driverstr; if ($driver eq "Postscript") { $driverstr = "PostScript"; @@ -1114,7 +1111,7 @@ sub set_cups_special_options { # If nothing is already configured, set text file borders of half an inch # and decrease the font size a little bit, so nothing of the text gets # cut off by unprintable borders. - if (!grep { /$queue.*\s(page-(top|bottom|left|right)|lpi|cpi)=/ } @lpoptions){ + if (!grep { /$queue.*\s(page-(top|bottom|left|right)|lpi|cpi)=/ } @lpoptions) { run_program::rooted($prefix, "lpoptions", "-p", $queue, "-o", "page-top=36", "-o", "page-bottom=36", @@ -2753,15 +2750,14 @@ sub findsofficeconfigfile { "/usr/local/lib/*/share/xp3/Xpdefaults", "/usr/local/*/share/xp3/Xpdefaults", "/opt/*/share/xp3/Xpdefaults"); - my $configfilename = ""; - for $configfilename (@configfilenames) { + for my $configfilename (@configfilenames) { local *F; if (open F, "ls -r $prefix$configfilename 2> /dev/null |") { my $filename = <F>; close F; if ($filename) { if ($prefix ne "") { - $filename =~ s:^$prefix::; + $filename =~ s/^$prefix//; } # Work around a bug in the "ls" of "busybox". During # installation it outputs the mask given on the command line @@ -2780,15 +2776,14 @@ sub findopenofficeconfigfile { "/usr/local/lib/*/share/psprint/psprint.conf", "/usr/local/*/share/psprint/psprint.conf", "/opt/*/share/psprint/psprint.conf"); - my $configfilename = ""; - for $configfilename (@configfilenames) { + for my $configfilename (@configfilenames) { local *F; if (open F, "ls -r $prefix$configfilename 2> /dev/null |") { my $filename = <F>; close F; if ($filename) { if ($prefix ne "") { - $filename =~ s:^$prefix::; + $filename =~ s/^$prefix//; } # Work around a bug in the "ls" of "busybox". During # installation it outputs the mask given on the command line @@ -3145,7 +3140,7 @@ sub findgimpconfigfiles { if ((($uid == 0) || ($uid >= 500)) && ($username ne "nobody")) { foreach my $file (@configfilenames) { my $dir = "$homedir/$file"; - $dir =~ s:/[^/]*$::; + $dir =~ s,/[^/]*$,,; next if (-f $dir) && (! -d $dir); if (! -d "$prefix$dir") { run_program::rooted($prefix, diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 992b61a59..86afe9e24 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -1601,8 +1601,7 @@ sub get_db_entry { $printer->{DBENTRY} = ""; my $make = uc($printer->{configured}{$queue}{queuedata}{make}); my $model = $printer->{configured}{$queue}{queuedata}{model}; - my $key; - for $key (keys %printer::thedb) { + for my $key (keys %printer::thedb) { if ((($::expert) && ($key =~ /^$make\|$model\|.*\(recommended\)$/)) || ((!$::expert) && ($key =~ /^$make\|$model$/))) { $printer->{DBENTRY} = $key; @@ -1614,7 +1613,7 @@ sub get_db_entry { $model =~ s/PS//; $model =~ s/PostScript//; $model =~ s/Series//; - for $key (keys %printer::thedb) { + for my $key (keys %printer::thedb) { if ((($::expert) && ($key =~ /^$make\|$model\|.*\(recommended\)$/)) || ((!$::expert) && ($key =~ /^$make\|$model$/))) { $printer->{DBENTRY} = $key; @@ -1990,8 +1989,7 @@ sub setup_options { # enumerated option push(@choicelists, []); push(@shortchoicelists, []); - my $choice; - for $choice (@{$printer->{ARGS}[$i]{vals}}) { + for my $choice (@{$printer->{ARGS}[$i]{vals}}) { push(@{$choicelists[$i]}, $choice->{comment}); push(@{$shortchoicelists[$i]}, $choice->{value}); if ($choice->{value} eq $optshortdefault) { @@ -2590,7 +2588,7 @@ sub check_network { [ { val => \$choice, type => 'list', list => [ N("Configure the network now"), N("Go on without configuring the network") ]} ] )) { - if ($choice eq N("Configure the network now")){ + if ($choice eq N("Configure the network now")) { if ($::isInstall) { require network::netconnect; network::netconnect::main @@ -3491,9 +3489,8 @@ What do you want to modify on this printer?", $printer->{DBENTRY} = undef; #- Which printer type did we have before (check beginning of #- URI) - my $type; if ($printer->{configured}{$queue}) { - for $type (qw(file lpd socket smb ncp postpipe)) { + for my $type (qw(file lpd socket smb ncp postpipe)) { if ($printer->{currentqueue}{connect} =~ /^$type:/) { $printer->{TYPE} = diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm index 8deb60cff..698d67c68 100755 --- a/perl-install/scanner.pm +++ b/perl-install/scanner.pm @@ -171,7 +171,7 @@ sub updateScannerDBfromSane { opendir YREP, $_sanesrcdir or die "can't open $_sanesrcdir: $!"; @files = grep /.*desc$/, readdir YREP; closedir YREP; - foreach $i (@files) { + foreach my $i (@files) { my $F = common::openFileMaybeCompressed("$_sanesrcdir/$i"); print Y "\n# from $i"; my ($lineno, $cmd, $val) = 0; |