The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
## name Simple block
## failures 2
## cut

my $x;
{
    my $x;
}

sub foo {
    my $i;
    {
        my $i;
    }
}

#-----------------------------------------------------------------------------

## name Array
## failures 1
## cut

my @x;
{
    my @x;
}

#-----------------------------------------------------------------------------

## name Hash
## failures 1
## cut

my %x;
{
    my %x;
}

#-----------------------------------------------------------------------------

## name Outer bleeds into sub
## failures 3
## cut

my $x;
{
    my $x;
}

sub foo {
    my $x;
    {
        my $x;
    }
}

#-----------------------------------------------------------------------------

## name Reversed scope
## failures 0
## cut

{
    my $x;
}
my $x;

sub foo {
    {
        my $i;
    }
    my $i;
}

#-----------------------------------------------------------------------------

## name Our
## failures 2
## cut

our $x;
{
    our $x;
}

sub foo {
    our $i;
    {
        our $i;
    }
}

#-----------------------------------------------------------------------------

## name Our vs. my
## failures 2
## cut

our $x;
{
    my $x;
}

sub foo {
    our $i;
    {
        my $i;
    }
}

#-----------------------------------------------------------------------------

## name Same scope
## failures 2
## cut

my $x;
my $x;

sub foo {
    my $i;
    my $i;
}

#-----------------------------------------------------------------------------

## name Conditional block
## failures 2
## cut

my $x;
if (1) {
    my $x;
}

sub foo {
    my $i;
    if (1) {
        my $i;
    }
}

#-----------------------------------------------------------------------------

## name For loop
## failures 2
## cut

my $x;
for my $y (0..10) {
    my $x;
}

sub foo {
    my $i;
    for my $z (0..10) {
        my $i;
    }
}

#-----------------------------------------------------------------------------

## name While loop
## failures 2
## cut

my $x;
while (1) {
    my $x;
}

sub foo {
    my $i;
    while (1) {
        my $i;
    }
}

#-----------------------------------------------------------------------------

## name Deep block
## failures 2
## cut

my $x;
for (0..5) {
    while (1) {
        if (foo()) {
            {
                my $x;
            }
        }
    }
}

sub foo {
    my $i;
    for (0..5) {
        while (1) {
            if (foo()) {
                {
                    my $i;
                }
            }
        }
    }
}

#-----------------------------------------------------------------------------

## name Other "my" syntax
## failures 4
## cut

my $x;
{
    my ($x, $y, @z);
    {
        my ($x, $y, @z, $w);
        {
            my (@w);
        }
    }
}

#-----------------------------------------------------------------------------

## name Empty "my" (which is invalid Perl syntax, but supported)
## failures 0
## cut

my $x;
{
    my ();
}

#-----------------------------------------------------------------------------

## name $self - RT #42767
## failures 0
## cut

my $self;
{
    my $self;
}

#-----------------------------------------------------------------------------

## name $class - RT #42767
## failures 0
## cut

my $class;
{
    my $class;
}

#-----------------------------------------------------------------------------

## name allow
## failures 0
## parms { allow => '$foobie' }
## cut

my $foobie;
{
    my $foobie;
}

#-----------------------------------------------------------------------------

## name our with multiple packages - RT #43754
## failures 0
## TODO We don't handle multiple packages in general, let alone in this policy.
## cut

package Foo;
our @ISA;
package Bar;
our @ISA;

#-----------------------------------------------------------------------------
# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :