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";