Make libs clean under '-w'
authorJarkko Hietaniemi <jhi@cc.hut.fi>
Thu, 2 Jan 1997 05:27:47 +0000 (17:27 +1200)
committerChip Salzenberg <chip@atlantic.net>
Sat, 4 Jan 1997 05:44:00 +0000 (17:44 +1200)
14 files changed:
lib/AutoSplit.pm
lib/Devel/SelfStubber.pm
lib/Env.pm
lib/Math/Complex.pm
lib/Pod/Functions.pm
lib/Search/Dict.pm
lib/SelfLoader.pm
lib/Term/Complete.pm
lib/chat2.pl
lib/complete.pl
lib/diagnostics.pm
lib/ftp.pl
lib/termcap.pl
lib/validate.pl

index d9bd17a..cc9de33 100644 (file)
@@ -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";
            }
index 7bb38f6..4c2d039 100644 (file)
@@ -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);
        }
     }
index 63beb07..1f06beb 100644 (file)
@@ -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*$/;
     }
index aec0776..fce53f7 100644 (file)
@@ -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;
index a775cf6..6db7cfd 100644 (file)
@@ -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',
index 1cd5cf8..9a229a7 100644 (file)
@@ -61,7 +61,7 @@ sub look {
     <FH> if $min;
     for (;;) {
        $min = tell(FH);
-       $_ = <FH>
+       defined($_ = <FH>)
            or last;
        chop;
        s/[^\w\s]//g if $dict;
index 11dc6a2..8d80b57 100644 (file)
@@ -44,7 +44,7 @@ sub _load_stubs {
         unless fileno($fh);
     $Cache{"${currpack}::<DATA"} = 1;   # indicate package is cached
 
-    while($line = <$fh> 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;
index bdab2ad..e3c290a 100644 (file)
@@ -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;
                     }
index 0d9a7d3..8320270 100644 (file)
@@ -264,7 +264,7 @@ ESQ
                eval $cases; die "$cases:\n$@" if $@;
        }
        $eof = $timeout = 0;
-       do $subname();
+       &$subname();
 }
 
 ## &chat'print([$handle,] @data)
index 3352452..539f2f7 100644 (file)
@@ -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;
                     }
index 3492bd3..b00349f 100644 (file)
@@ -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;
index bfddcb8..9528360 100644 (file)
@@ -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 ){
index c36575a..3731343 100644 (file)
@@ -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;
index 21d0505..ec4a04b 100644 (file)
@@ -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;