| 1 | package Getopt::Long::Modern; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Getopt::Long 'GetOptions'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Exporter (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '1.000'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | our @ISA = 'Exporter'; | |||||||||||||||||||||||||||
| 11 | 1 | our @EXPORT = 'GetOptions'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | my @config = qw(default gnu_getopt no_ignore_case); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||
| 16 | 2 | my $class = shift; | |||||||||||||||||||||||||||
| 17 | 2 | $class->export_to_level(1); | |||||||||||||||||||||||||||
| 18 | 2 | ▶ | shift if @_ and $_[0] eq ':config'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ and $_[0] eq ":config"
MC/DC0%0/2
@_ and $_[0] eq ":config"
@_
$_[0] eq ":config"
Truth table66%2/3
A and B
A= @_B= $_[0] eq ":config"
| |||||||||||||||||||||||||||||
| 19 | 2 | Getopt::Long::Configure(@config, @_); | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | 1; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head1 NAME | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | Getopt::Long::Modern - Use Getopt::Long with modern defaults | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | use Getopt::Long::Modern; | ||||||||||||||||||||||||||||
| 31 | GetOptions( | ||||||||||||||||||||||||||||
| 32 | "f|foo=i" => \my $foo, | ||||||||||||||||||||||||||||
| 33 | "b|bar" => \my $bar, | ||||||||||||||||||||||||||||
| 34 | "Z|baz=s" => \my @baz, | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | L<Getopt::Long::Modern> is a simple wrapper of L<Getopt::Long> to reduce the | ||||||||||||||||||||||||||||
| 40 | amount of typing needed to get modern defaults, and to avoid having to remember | ||||||||||||||||||||||||||||
| 41 | the correct incantations. See L<Getopt::Long/"Summary of Option Specifications"> | ||||||||||||||||||||||||||||
| 42 | for details on specifying options using L<Getopt::Long>. | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Only the C<GetOptions> function from L<Getopt::Long> is exported. Additional | ||||||||||||||||||||||||||||
| 45 | L<Getopt::Long> configuration may be passed as import parameters. | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | use Getopt::Long::Modern qw(auto_help auto_version pass_through); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | For any more advanced usage, you should probably use L<Getopt::Long> directly. | ||||||||||||||||||||||||||||
| 50 | The equivalent L<Getopt::Long> configuration to using this module is: | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | use Getopt::Long qw(:config gnu_getopt no_ignore_case); | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head1 DEFAULTS | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | L<Getopt::Long::Modern> currently sets the following configuration options by | ||||||||||||||||||||||||||||
| 57 | default. See L<Getopt::Long/"Configuring Getopt::Long"> for more details on | ||||||||||||||||||||||||||||
| 58 | available configuration. | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head2 gnu_getopt | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | This sets C<gnu_compat> to allow C<--opt=> for setting an empty string option, | ||||||||||||||||||||||||||||
| 63 | C<bundling> to allow short options to be bundled together, C<permute> to allow | ||||||||||||||||||||||||||||
| 64 | specifying options before or after other arguments, and C<no_getopt_compat> to | ||||||||||||||||||||||||||||
| 65 | disallow C<+> for specifying options. | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =head2 no_ignore_case | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | This makes all options case-sensitive, which is expected and required when | ||||||||||||||||||||||||||||
| 70 | explicitly specifying short options of the same character but different case. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =head1 BUGS | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | Report any issues on the public bugtracker. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | Dan Book <dbook@cpan.org> | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | This software is Copyright (c) 2015 by Dan Book. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | This is free software, licensed under: | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | The Artistic License 2.0 (GPL Compatible) | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | L<Getopt::Long::Descriptive>, L<Getopt::Again>, L<Opt::Imistic> | ||||||||||||||||||||||||||||