From b0d554c4155060ed665844fdf7b2a08db9bb3356 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 27 Nov 2002 20:50:12 +0000 Subject: perl_checker adaptations --- perl-install/commands.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'perl-install/commands.pm') diff --git a/perl-install/commands.pm b/perl-install/commands.pm index f5cc2f44c..4d562a7ca 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -10,7 +10,7 @@ package commands; # $Id$ use diagnostics; use strict; -use vars qw($printable_chars); +use vars qw($printable_chars *ROUTE); #-###################################################################################### #- misc imports @@ -287,15 +287,15 @@ sub head_tail { my ($h, $n) = getopts(\@_, qw(hn)); $h || @_ < to_bool($n) and die "usage: $0 [-h] [-n lines] []\n"; $n = $n ? shift : 10; - local *F; @_ ? open(F, $_[0]) || die "error: can't open file $_[0]\n" : (*F = *STDIN); + my $fh; @_ ? open($fh, $_[0]) || die "error: can't open file $_[0]\n" : ($fh = *STDIN); if ($0 eq 'head') { local $_; - while () { $n-- or return; print } + while (<$fh>) { $n-- or return; print } } else { @_ = (); local $_; - while () { push @_, $_; @_ > $n and shift } + while (<$fh>) { push @_, $_; @_ > $n and shift } print @_; } } @@ -430,7 +430,7 @@ sub route { my ($titles, @l) = cat_("/proc/net/route"); my @titles = split ' ', $titles; my %l; - open ROUTE, ">&STDOUT"; #-# ROUTE must be not be localised otherwise the "format ROUTE" fails + open ROUTE, ">&STDOUT"; #- ROUTE must be not be localised otherwise the "format ROUTE" fails format ROUTE_TOP = Destination Gateway Mask Iface . @@ -441,7 +441,7 @@ $l{Destination}, $l{Gateway}, $l{Mask}, $l{Iface} foreach (@l) { /^\s*$/ and next; @l{@titles} = split; - $_ = join ".", reverse map { hex } unpack "a2a2a2a2", $_ foreach @l{qw(Destination Gateway Mask)}; + $_ = join ".", reverse map { hex $_ } unpack "a2a2a2a2", $_ foreach @l{qw(Destination Gateway Mask)}; $l{Destination} = 'default' if $l{Destination} eq "0.0.0.0"; $l{Gateway} = '*' if $l{Gateway} eq "0.0.0.0"; write ROUTE; @@ -492,18 +492,18 @@ sub lspci { require detect_devices; print join "\n", detect_devices::stringlist(1), ''; } -*lssbus = *lspci; +*lssbus = \&lspci; sub dmesg { print cat_("/tmp/syslog") } sub sort { my ($n, $h) = getopts(\@_, qw(nh)); $h and die "usage: sort [-n] []\n"; - local *F; @_ ? open(F, $_[0]) || die "error: can't open file $_[0]\n" : (*F = *STDIN); + my $fh; @_ ? open($fh, $_[0]) || die "error: can't open file $_[0]\n" : ($fh = *STDIN); if ($n) { - print(sort { $a <=> $b } ); + print(sort { $a <=> $b } <$fh>); } else { - print(sort ); + print(sort <$fh>); } } -- cgit v1.2.1