summaryrefslogtreecommitdiffstats
path: root/perl-install/commands.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-11 13:40:09 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-11 13:40:09 +0000
commit2db19d156087ccce3037b2bd2da1042280e17904 (patch)
tree0acaff93899445e13d78facbd0aa0da28558a04f /perl-install/commands.pm
parentc1e398be894ecce6394bd76c99b76c022979ac62 (diff)
downloaddrakx-2db19d156087ccce3037b2bd2da1042280e17904.tar
drakx-2db19d156087ccce3037b2bd2da1042280e17904.tar.gz
drakx-2db19d156087ccce3037b2bd2da1042280e17904.tar.bz2
drakx-2db19d156087ccce3037b2bd2da1042280e17904.tar.xz
drakx-2db19d156087ccce3037b2bd2da1042280e17904.zip
- do not use "foreach $var (...) {...}" use "foreach my $var (...) {...}" instead
(only pb are functions called in {...} that could use $var, none found except in commands.pm) - various small syntax enhancements to please perl_checker
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r--perl-install/commands.pm24
1 files changed, 13 insertions, 11 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>);
}
}