From: Jarkko Hietaniemi Date: Thu, 2 Jan 1997 05:27:47 +0000 (+1200) Subject: Make libs clean under '-w' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=40da2db335c65d50d3bca886fcc7161ed72faf74;p=p5sagit%2Fp5-mst-13.2.git Make libs clean under '-w' --- diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm index d9bd17a..cc9de33 100644 --- a/lib/AutoSplit.pm +++ b/lib/AutoSplit.pm @@ -255,7 +255,7 @@ sub autosplit_file{ if (/^sub\s+([\w:]+)(\s*\(.*?\))?/) { print OUT "1;\n"; my $subname = $1; - $proto{$1} = $2 or ''; + $proto{$1} = $2 || ''; if ($subname =~ m/::/){ warn "subs with package names not currently supported in AutoSplit section"; } diff --git a/lib/Devel/SelfStubber.pm b/lib/Devel/SelfStubber.pm index 7bb38f6..4c2d039 100644 --- a/lib/Devel/SelfStubber.pm +++ b/lib/Devel/SelfStubber.pm @@ -35,7 +35,7 @@ sub stub { $fh = "${module}::DATA"; open($fh,$mod_file) || die "Unable to open $mod_file"; - while($line = <$fh> and $line !~ m/^__DATA__/) { + while(defined ($line = <$fh>) and $line !~ m/^__DATA__/) { push(@BEFORE_DATA,$line); $line =~ /use\s+SelfLoader/ && $found_selfloader++; } @@ -45,7 +45,7 @@ sub stub { $self->_load_stubs($module); if ( fileno($fh) ) { $end = 1; - while($line = <$fh>) { + while(defined($line = <$fh>)) { push(@AFTER_DATA,$line); } } diff --git a/lib/Env.pm b/lib/Env.pm index 63beb07..1f06beb 100644 --- a/lib/Env.pm +++ b/lib/Env.pm @@ -47,7 +47,11 @@ sub import { my ($callpack) = caller(0); my $pack = shift; my @vars = @_ ? @_ : keys(%ENV); + return unless @vars; + eval "package $callpack; use vars qw(" + . join(' ', map { '$'.$_ } @vars) . ")"; + die $@ if $@; foreach (@vars) { tie ${"${callpack}::$_"}, Env, $_ if /^[A-Za-z_]\w*$/; } diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm index aec0776..fce53f7 100644 --- a/lib/Math/Complex.pm +++ b/lib/Math/Complex.pm @@ -56,7 +56,7 @@ $display = 'cartesian'; # Default display format sub make { my $self = bless {}, shift; my ($re, $im) = @_; - $self->{cartesian} = [$re, $im]; + $self->{'cartesian'} = [$re, $im]; $self->{c_dirty} = 0; $self->{p_dirty} = 1; return $self; @@ -71,7 +71,7 @@ sub emake { my $self = bless {}, shift; my ($rho, $theta) = @_; $theta += pi() if $rho < 0; - $self->{polar} = [abs($rho), $theta]; + $self->{'polar'} = [abs($rho), $theta]; $self->{p_dirty} = 0; $self->{c_dirty} = 1; return $self; @@ -118,8 +118,8 @@ sub pi () { # sub i () { $i = bless {} unless $i; # There can be only one i - $i->{cartesian} = [0, 1]; - $i->{polar} = [1, pi/2]; + $i->{'cartesian'} = [0, 1]; + $i->{'polar'} = [1, pi/2]; $i->{c_dirty} = 0; $i->{p_dirty} = 0; return $i; @@ -129,11 +129,11 @@ sub i () { # Attribute access/set routines # -sub cartesian {$_[0]->{c_dirty} ? $_[0]->update_cartesian : $_[0]->{cartesian}} -sub polar {$_[0]->{p_dirty} ? $_[0]->update_polar : $_[0]->{polar}} +sub cartesian {$_[0]->{c_dirty} ? $_[0]->update_cartesian : $_[0]->{'cartesian'}} +sub polar {$_[0]->{p_dirty} ? $_[0]->update_polar : $_[0]->{'polar'}} -sub set_cartesian { $_[0]->{p_dirty}++; $_[0]->{cartesian} = $_[1] } -sub set_polar { $_[0]->{c_dirty}++; $_[0]->{polar} = $_[1] } +sub set_cartesian { $_[0]->{p_dirty}++; $_[0]->{'cartesian'} = $_[1] } +sub set_polar { $_[0]->{c_dirty}++; $_[0]->{'polar'} = $_[1] } # # ->update_cartesian @@ -142,9 +142,9 @@ sub set_polar { $_[0]->{c_dirty}++; $_[0]->{polar} = $_[1] } # sub update_cartesian { my $self = shift; - my ($r, $t) = @{$self->{polar}}; + my ($r, $t) = @{$self->{'polar'}}; $self->{c_dirty} = 0; - return $self->{cartesian} = [$r * cos $t, $r * sin $t]; + return $self->{'cartesian'} = [$r * cos $t, $r * sin $t]; } # @@ -155,10 +155,10 @@ sub update_cartesian { # sub update_polar { my $self = shift; - my ($x, $y) = @{$self->{cartesian}}; + my ($x, $y) = @{$self->{'cartesian'}}; $self->{p_dirty} = 0; - return $self->{polar} = [0, 0] if $x == 0 && $y == 0; - return $self->{polar} = [sqrt($x*$x + $y*$y), atan2($y, $x)]; + return $self->{'polar'} = [0, 0] if $x == 0 && $y == 0; + return $self->{'polar'} = [sqrt($x*$x + $y*$y), atan2($y, $x)]; } # @@ -707,7 +707,7 @@ sub stringify_cartesian { $re = "$x" if abs($x) >= 1e-14; if ($y == 1) { $im = 'i' } elsif ($y == -1) { $im = '-i' } - elsif (abs($y) >= 1e-14) { $im = "${y}i" } + elsif (abs($y) >= 1e-14) { $im = $y . "i" } my $str; $str = $re if defined $re; diff --git a/lib/Pod/Functions.pm b/lib/Pod/Functions.pm index a775cf6..6db7cfd 100644 --- a/lib/Pod/Functions.pm +++ b/lib/Pod/Functions.pm @@ -5,7 +5,7 @@ package Pod::Functions; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(%Kinds %Type %Flavor %Type_Descriptions @Type_Order); +@EXPORT = qw(%Kinds %Type %Flavor %Type_Description @Type_Order); %Type_Description = ( 'ARRAY' => 'Functions for real @ARRAYs', diff --git a/lib/Search/Dict.pm b/lib/Search/Dict.pm index 1cd5cf8..9a229a7 100644 --- a/lib/Search/Dict.pm +++ b/lib/Search/Dict.pm @@ -61,7 +61,7 @@ sub look { if $min; for (;;) { $min = tell(FH); - $_ = + defined($_ = ) or last; chop; s/[^\w\s]//g if $dict; diff --git a/lib/SelfLoader.pm b/lib/SelfLoader.pm index 11dc6a2..8d80b57 100644 --- a/lib/SelfLoader.pm +++ b/lib/SelfLoader.pm @@ -44,7 +44,7 @@ sub _load_stubs { unless fileno($fh); $Cache{"${currpack}:: and $line !~ m/^__END__/) { + while(defined($line = <$fh>) and $line !~ m/^__END__/) { if ($line =~ m/^sub\s+([\w:]+)\s*(\([\$\@\;\%\\]*\))?/) { # A sub declared push(@stubs, $self->_add_to_cache($name, $currpack, \@lines, $protoype)); $protoype = $2; diff --git a/lib/Term/Complete.pm b/lib/Term/Complete.pm index bdab2ad..e3c290a 100644 --- a/lib/Term/Complete.pm +++ b/lib/Term/Complete.pm @@ -112,7 +112,8 @@ sub Complete { # (^U) kill $_ eq $kill && do { if ($r) { - undef($r, $return); + undef $r; + undef $return; print("\r\n"); redo LOOP; } diff --git a/lib/chat2.pl b/lib/chat2.pl index 0d9a7d3..8320270 100644 --- a/lib/chat2.pl +++ b/lib/chat2.pl @@ -264,7 +264,7 @@ ESQ eval $cases; die "$cases:\n$@" if $@; } $eof = $timeout = 0; - do $subname(); + &$subname(); } ## &chat'print([$handle,] @data) diff --git a/lib/complete.pl b/lib/complete.pl index 3352452..539f2f7 100644 --- a/lib/complete.pl +++ b/lib/complete.pl @@ -75,7 +75,8 @@ sub Complete { # (^U) kill $_ eq $kill && do { if ($r) { - undef($r, $return); + undef $r; + undef $return; print("\r\n"); redo LOOP; } diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index 3492bd3..b00349f 100644 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -352,7 +352,7 @@ EOFUNC if ($standalone) { if (!@ARGV and -t STDIN) { print STDERR "$0: Reading from STDIN\n" } - while ($error = <>) { + while (defined ($error = <>)) { splainthis($error) || print THITHER $error; } exit; diff --git a/lib/ftp.pl b/lib/ftp.pl index bfddcb8..9528360 100644 --- a/lib/ftp.pl +++ b/lib/ftp.pl @@ -140,7 +140,7 @@ $real_site = ""; $ftp_show = 0; sub ftp'debug { - $ftp_show = @_[0]; + $ftp_show = $_[0]; # if( $ftp_show ){ # print STDERR "ftp debugging on\n"; # } @@ -148,7 +148,7 @@ sub ftp'debug sub ftp'set_timeout { - $timeout = @_[0]; + $timeout = $_[0]; $timeout_open = $timeout; $timeout_read = 20 * $timeout; if( $ftp_show ){ diff --git a/lib/termcap.pl b/lib/termcap.pl index c36575a..3731343 100644 --- a/lib/termcap.pl +++ b/lib/termcap.pl @@ -14,7 +14,7 @@ sub Tgetent { local($TERMCAP,$_,$entry,$loop,$field); warn "Tgetent: no ospeed set" unless $ospeed; - foreach $key (keys(TC)) { + foreach $key (keys %TC) { delete $TC{$key}; } $TERM = $ENV{'TERM'} unless $TERM; diff --git a/lib/validate.pl b/lib/validate.pl index 21d0505..ec4a04b 100644 --- a/lib/validate.pl +++ b/lib/validate.pl @@ -91,11 +91,11 @@ sub valmess { $mess =~ s/ does not / should not / || $mess =~ s/ not / /; } - print stderr $mess,"\n"; + print STDERR $mess,"\n"; } else { $this =~ s/\$file/'$file'/g; - print stderr "Can't do $this.\n"; + print STDERR "Can't do $this.\n"; } if ($disposition eq 'die') { exit 1; } ++$warnings;