This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove a spurious undefined warning when using getopts.pl with -w.
[perl5.git] / lib / base.pm
index e98d0f1..832b6a4 100644 (file)
@@ -152,10 +152,9 @@ sub inherit_fields {
         }
     }
 
-    unless( keys %$bfields ) {
-        foreach my $idx (1..$#{$battr}) {
-            $dattr->[$idx] = $battr->[$idx] & INHERITED;
-        }
+    foreach my $idx (1..$#{$battr}) {
+       next if defined $dattr->[$idx];
+       $dattr->[$idx] = $battr->[$idx] & INHERITED;
     }
 }