houseabsolute / p5-Test-Vars

Detects unused variables in unit tests
https://metacpan.org/pod/Test::Vars
Other
6 stars 10 forks source link

doesn't work with implied variable usage (RT 60018) #56

Open jkeenan opened 1 month ago

jkeenan commented 1 month ago

Transferred from rt.cpan.org ...

Original Ticket Information

Original Text

I'm using this via Dist-Zilla-Plugin-UnusedVarsTests. Which complains about an unused my $_; however $_ is not unused it's just that all instances of it in the subroutine are implied.

sub something {
    my $_;
    my @array = ...;
    while ( @array ) {
        say;
    }
}

UnusedVarsTests would fail in this case even though technically $_ is being used on say.

Follow-Up Report

oh some further discussion I had on StackOverflow