diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-11-06 16:47:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-11-06 16:47:00 +0000 |
commit | 3021e910718c4702abe831c7aa53e8a7bf8b135f (patch) | |
tree | e342014ee05783e78a37b18970bd6168610c30f8 /perl-install/commands.pm | |
parent | 371749c6a25c7aec0874e21d68ec212b2bf2dab7 (diff) | |
download | drakx-3021e910718c4702abe831c7aa53e8a7bf8b135f.tar drakx-3021e910718c4702abe831c7aa53e8a7bf8b135f.tar.gz drakx-3021e910718c4702abe831c7aa53e8a7bf8b135f.tar.bz2 drakx-3021e910718c4702abe831c7aa53e8a7bf8b135f.tar.xz drakx-3021e910718c4702abe831c7aa53e8a7bf8b135f.zip |
please perl_checker:
- local'ize $_ before doing while (<...>)
- use "foreach" instead of "for"
- remove unneeded parentheses on the right side of infix if/foreach/unless
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r-- | perl-install/commands.pm | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 4828c506e..f3503eb10 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -319,11 +319,13 @@ sub head_tail { $n = $n ? shift : 10; local *F; @_ ? open(F, $_[0]) || die "error: can't open file $_[0]\n" : (*F = *STDIN); - local $_; if ($0 eq 'head') { + local $_; while (<F>) { $n-- or return; print } } else { - @_ = (); while (<F>) { push @_, $_; @_ > $n and shift } + @_ = (); + local $_; + while (<F>) { push @_, $_; @_ > $n and shift } print @_; } } @@ -334,7 +336,9 @@ sub strings { my ($h, $o, $n) = getopts(\@_, qw(hon)); $h and die "usage: strings [-o] [-n min-length] [<files>]\n"; $n = $n ? shift : 4; - $/ = "\0"; @ARGV = @_; my $l = 0; while (<>) { + $/ = "\0"; @ARGV = @_; my $l = 0; + local $_; + while (<>) { while (/[$printable_chars]{$n,}/og) { printf "%07d ", ($l + length $') if $o; print "$&\n" ; @@ -344,7 +348,9 @@ sub strings { } sub hexdump { - my $i = 0; $/ = \16; @ARGV = @_; while (<>) { + my $i = 0; $/ = \16; @ARGV = @_; + local $_; + while (<>) { printf "%08lX ", $i; $i += 16; print join(" ", (map { sprintf "%02X", $_ } unpack("C*", $_)), (s/[^$printable_chars]/./og, $_)[1]), "\n"; @@ -355,8 +361,10 @@ sub more { @ARGV = @_; require devices; my $tty = devices::make('tty'); - local *IN; open IN, "<$tty" or die "can't open $tty\n"; - my $n = 0; while (<>) { + my $n = 0; + local *IN; open IN, $tty or die "can't open $tty\n"; + local $_; + while (<>) { if (++$n == 25) { my $v = <IN>; $v =~ /^q/ and exit 0; |