On 7/13/05, Rick Delaney <[EMAIL PROTECTED]> wrote: > I agree too. The following patch will make the first case warn too. > Note that it also changes this current behaviour: > > % perl -wle 'our $p; package X; our $p;' > % perl -wle 'our $p; package X; my $p;' > "my" variable $p masks earlier declaration in same scope at -e line 1.
I've applied a slightly modified version of your patch to bleadperl, to match the semantics defined earlier : Change 25179 on 2005/07/19 by [EMAIL PROTECTED] Overhaul the semantics of the warning ""%s" variable %s masks earlier declaration", based on a patch by Rick Delaney. Now we have : my $x; my $x; # warns my $x; our $x; # warns our $x; my $x; # warns our $x; our $x; # silent http://public.activestate.com/cgi-bin/perlbrowse?patch=25179 The presence of a package declaration between the two lexical variable delacarations doesn't change the warning case. I think the "our variable redeclared" warning can be extended to the case our $x; our $x; but specifically not to the case our $x; package X; our $x; since in this latest case the 2nd $x is bound to $X::x and not $main::x. Agreed ?