Skip Menu |

This queue is for tickets about the Perl-Critic-TooMuchCode CPAN distribution.

Report information
The Basics
Id: 126922
Status: resolved
Priority: 0/
Queue: Perl-Critic-TooMuchCode

People
Owner: Nobody in particular
Requestors: HMBRAND [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.05



Subject: use options can be meta-options
$ cat test.pl #!/pro/bin/perl use 5.12.0; use warnings; our $VERSION = "1.00"; sub usage { my $err = shift and select STDERR; say "usage: $0 [-x] [-y]"; exit $err; } # usage use Getopt::Long qw(:config bundling); GetOptions ( "help|?" => sub { usage (0); }, "V|version" => sub { say "$0 [$VERSION]"; exit 0; }, "x!" => \my $opt_x, "y!" => \my $opt_y, ) or usage (1); $opt_x and say "Xantippe"; $opt_y and say "Yardbird"; $ perlcritic -1 test.pl test.pl#14.5: [1 - TooMuchCode::ProhibitUnusedImport] Unused import :use Getopt::Long qw(:config bundling);
Subject: test.pl
#!/pro/bin/perl use 5.12.0; use warnings; our $VERSION = "1.00"; sub usage { my $err = shift and select STDERR; say "usage: $0 [-x] [-y]"; exit $err; } # usage use Getopt::Long qw(:config bundling); GetOptions ( "help|?" => sub { usage (0); }, "V|version" => sub { say "$0 [$VERSION]"; exit 0; }, "x!" => \my $opt_x, "y!" => \my $opt_y, ) or usage (1); $opt_x and say "Xantippe"; $opt_y and say "Yardbird";
https://github.com/gugod/Perl-Critic-TooMuchCode/commit/3ab82d6ca47895fe5d92464ad06a9292e6814860 I pushed an easy solution, which is to just ignore modules like Getopt::Long -- which has arguments meaning something other than symbols to import. In the case of Getopt::Long, it looks like the symbols before ":config" keyword are the imported symbols, but not the symbols afterwards. A specialized implementation for Getopt::Long should not be a big deal.
The fix commit was release in part of 0.05.